From c635d78b479510ebe2556a420948effcd30a0731 Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期六, 21 十二月 2024 18:40:43 +0800 Subject: [PATCH] 新建德森项目分支 --- zy-asrs-flow/src/components/IconSelector/Category.tsx | 126 +++++++++++++++++++++--------------------- 1 files changed, 63 insertions(+), 63 deletions(-) diff --git a/zy-asrs-flow/src/components/IconSelector/Category.tsx b/zy-asrs-flow/src/components/IconSelector/Category.tsx index dd0e93f..8c90b50 100644 --- a/zy-asrs-flow/src/components/IconSelector/Category.tsx +++ b/zy-asrs-flow/src/components/IconSelector/Category.tsx @@ -1,63 +1,63 @@ -import * as React from 'react'; -import CopyableIcon from './CopyableIcon'; -import type { ThemeType } from './index'; -import type { CategoriesKeys } from './fields'; -import { useIntl } from '@umijs/max'; -import styles from './style.less'; - -interface CategoryProps { - title: CategoriesKeys; - icons: string[]; - theme: ThemeType; - newIcons: string[]; - onSelect: (type: string, name: string) => any; -} - -const Category: React.FC<CategoryProps> = props => { - - const { icons, title, newIcons, theme } = props; - const intl = useIntl(); - const [justCopied, setJustCopied] = React.useState<string | null>(null); - const copyId = React.useRef<NodeJS.Timeout | null>(null); - const onSelect = React.useCallback((type: string, text: string) => { - const { onSelect } = props; - if (onSelect) { - onSelect(type, text); - } - setJustCopied(type); - copyId.current = setTimeout(() => { - setJustCopied(null); - }, 2000); - }, []); - React.useEffect( - () => () => { - if (copyId.current) { - clearTimeout(copyId.current); - } - }, - [], - ); - - return ( - <div> - <h4>{intl.formatMessage({ - id: `app.docs.components.icon.category.${title}`, - defaultMessage: '淇℃伅', - })}</h4> - <ul className={styles.anticonsList}> - {icons.map(name => ( - <CopyableIcon - key={name} - name={name} - theme={theme} - isNew={newIcons.includes(name)} - justCopied={justCopied} - onSelect={onSelect} - /> - ))} - </ul> - </div> - ); -}; - -export default Category; +import * as React from 'react'; +import CopyableIcon from './CopyableIcon'; +import type { ThemeType } from './index'; +import type { CategoriesKeys } from './fields'; +import { useIntl } from '@umijs/max'; +import styles from './style.less'; + +interface CategoryProps { + title: CategoriesKeys; + icons: string[]; + theme: ThemeType; + newIcons: string[]; + onSelect: (type: string, name: string) => any; +} + +const Category: React.FC<CategoryProps> = props => { + + const { icons, title, newIcons, theme } = props; + const intl = useIntl(); + const [justCopied, setJustCopied] = React.useState<string | null>(null); + const copyId = React.useRef<NodeJS.Timeout | null>(null); + const onSelect = React.useCallback((type: string, text: string) => { + const { onSelect } = props; + if (onSelect) { + onSelect(type, text); + } + setJustCopied(type); + copyId.current = setTimeout(() => { + setJustCopied(null); + }, 2000); + }, []); + React.useEffect( + () => () => { + if (copyId.current) { + clearTimeout(copyId.current); + } + }, + [], + ); + + return ( + <div> + <h4>{intl.formatMessage({ + id: `app.docs.components.icon.category.${title}`, + defaultMessage: '淇℃伅', + })}</h4> + <ul className={styles.anticonsList}> + {icons.map(name => ( + <CopyableIcon + key={name} + name={name} + theme={theme} + isNew={newIcons.includes(name)} + justCopied={justCopied} + onSelect={onSelect} + /> + ))} + </ul> + </div> + ); +}; + +export default Category; -- Gitblit v1.9.1