UNPKG

@workday/canvas-kit-react

Version:

The parent module that contains all Workday Canvas Kit React components

21 lines (20 loc) 823 B
import React from 'react'; import { createComponent } from '@workday/canvas-kit-react/common'; import { SystemIcon } from '@workday/canvas-kit-react/icon'; import { px2rem } from '@workday/canvas-kit-styling'; const iconSizes = { extraSmall: 18, small: 20, medium: 20, large: 24, }; export const ButtonLabelIcon = createComponent('span')({ displayName: 'ButtonLabelIconNew', Component: ({ icon, size = 'medium', shouldMirrorIcon = false, ...elemProps }, ref, Element) => { if (icon === undefined) { return null; } const iconSize = iconSizes[size]; return (React.createElement(SystemIcon, { size: iconSize, icon: icon, shouldMirror: shouldMirrorIcon, width: px2rem(iconSize), height: px2rem(iconSize), display: "inline-block", ...elemProps })); }, });