diff --git a/packages/dev/s2-docs/src/IconPicker.tsx b/packages/dev/s2-docs/src/IconPicker.tsx index 3e8521af5a0..d10bd7e286e 100644 --- a/packages/dev/s2-docs/src/IconPicker.tsx +++ b/packages/dev/s2-docs/src/IconPicker.tsx @@ -11,6 +11,7 @@ import {useGlobalListeners} from '@react-aria/utils'; const iconList = Object.keys(icons).map(name => ({id: name.replace(/^S2_Icon_(.*?)(Size\d+)?_2.*/, '$1'), icon: icons[name].default})); const iconMap = Object.fromEntries(iconList.map(item => [item.id, item.icon])); +export const Icon = ({icon}) => createElement(iconMap[icon]); const itemStyle = style({ ...focusRing(), @@ -33,7 +34,7 @@ const itemStyle = style({ justifyContent: 'center' }); -type IconValue = string | {text?: string, icon?: string | null, iconJSX?: ReactNode} | null; +type IconValue = string | {text?: string, icon?: string | null} | null; interface IconPickerProps { value: IconValue, onChange: (value: IconValue) => void, @@ -64,12 +65,12 @@ export function IconPicker({value, onChange, label, contextualHelp}: IconPickerP return (