import * as React from 'react'; import { App } from 'antd'; import { createStyles } from 'antd-style'; import { useIntl } from 'dumi'; import CopyableIcon from './CopyableIcon'; import type { CategoriesKeys } from './fields'; import type { ThemeType } from './IconSearch'; const useStyle = createStyles(({ token, css }) => ({ anticonsList: css` margin: ${token.margin}px 0; overflow: hidden; direction: ltr; list-style: none; display: grid; grid-gap: ${token.margin}px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); padding: 0; `, copiedCode: css` padding: 0 ${token.paddingXXS}px; font-size: ${token.fontSizeSM}px; background-color: ${token.colorBgLayout}; border-radius: ${token.borderRadiusXS}px; `, })); interface CategoryProps { title: CategoriesKeys; icons: string[]; theme: ThemeType; newIcons: string[]; } const Category: React.FC = (props) => { const { message } = App.useApp(); const { icons, title, newIcons, theme } = props; const { styles } = useStyle(); const intl = useIntl(); const [justCopied, setJustCopied] = React.useState(null); const copyId = React.useRef | null>(null); const onCopied = React.useCallback((type: string, text: string) => { message.success( {text} copied 🎉 , ); setJustCopied(type); copyId.current = setTimeout(() => { setJustCopied(null); }, 2000); }, []); React.useEffect( () => () => { if (copyId.current) { clearTimeout(copyId.current); } }, [], ); return (

{intl.formatMessage({ id: `app.docs.components.icon.category.${title}` })}

    {icons.map((name) => ( ))}
); }; export default Category;