@metamask/design-system-react-native
Version:
27 lines • 1.01 kB
JavaScript
/* eslint-disable jsdoc/check-param-names */
/* eslint-disable jsdoc/require-param */
import { IconColor, IconSize } from "../../types/index.mjs";
/**
* Generates a Tailwind class name for the icon based on color and optional additional classes.
*
* @param color - The color of the icon, mapped to a Tailwind class.
* @param size - Different sizes map to specific pixel dimensions
* @param twClassName - Additional Tailwind class names for customization.
* @returns A combined string of class names.
*
* Example:
* ```
* const classNames = generateIconClassNames({
* color: IconColor.IconDefault,
* size: IconSize.Md
* });
*
* console.log(classNames);
* // Output: "text-icon-default w-[20px] h-[20px]"
* ```
*/
export const generateIconClassNames = ({ color = IconColor.IconDefault, size = IconSize.Md, twClassName = '', }) => {
const mergedClassnames = `${color} w-[${size}px] h-[${size}px] ${twClassName}`;
return mergedClassnames;
};
//# sourceMappingURL=Icon.utilities.mjs.map