import * as React from 'react'; import { message } from 'antd'; import { ThemeType } from '../../../../components/icon'; import CopyableIcon from './CopyableIcon'; import { injectIntl, InjectedIntlProps } from 'react-intl'; import { CategoriesKeys } from './fields'; interface CategoryProps extends InjectedIntlProps { title: CategoriesKeys; icons: string[]; theme: ThemeType; newIcons: string[]; } interface CategoryState { justCopied: string | null; } class Category extends React.Component { state = { justCopied: null, }; onCopied = (type: string, text: string) => { message.success({text} copied 🎉); this.setState({ justCopied: type }, () => { setTimeout(() => { this.setState({ justCopied: null }); }, 2000); }); } render() { const { icons, title, theme, newIcons, intl: { messages }, } = this.props; const items = icons.map((name) => { return ( = 0} justCopied={this.state.justCopied} onCopied={this.onCopied} /> ); }); return (

{messages[`app.docs.components.icon.category.${title}`]}

    {items}
); } } export default injectIntl(Category);