grommet/grommet

View on GitHub
src/js/utils/icon.js

Summary

Maintainability
A
0 mins
Test Coverage
import { cloneElement } from 'react';

export const useSizedIcon = (icon, size, theme) =>
  icon && theme?.icon?.matchSize && !icon.props.size
    ? cloneElement(icon, { size })
    : icon;