|
|
@ -3,6 +3,7 @@ import CopyToClipboard from 'react-copy-to-clipboard'; |
|
|
|
import { Badge } from 'antd'; |
|
|
|
import classNames from 'classnames'; |
|
|
|
import * as AntdIcons from '@ant-design/icons'; |
|
|
|
import { ThemeType } from './index'; |
|
|
|
|
|
|
|
const allIcons: { |
|
|
|
[key: string]: any; |
|
|
@ -11,13 +12,21 @@ const allIcons: { |
|
|
|
export interface CopyableIconProps { |
|
|
|
name: string; |
|
|
|
isNew: boolean; |
|
|
|
theme: ThemeType; |
|
|
|
justCopied: string | null; |
|
|
|
onCopied: (type: string, text: string) => any; |
|
|
|
} |
|
|
|
|
|
|
|
const CopyableIcon: React.SFC<CopyableIconProps> = ({ name, isNew, justCopied, onCopied }) => { |
|
|
|
const CopyableIcon: React.SFC<CopyableIconProps> = ({ |
|
|
|
name, |
|
|
|
isNew, |
|
|
|
justCopied, |
|
|
|
onCopied, |
|
|
|
theme, |
|
|
|
}) => { |
|
|
|
const className = classNames({ |
|
|
|
copied: justCopied === name, |
|
|
|
[theme]: !!theme, |
|
|
|
}); |
|
|
|
return ( |
|
|
|
<CopyToClipboard text={`<${name} />`} onCopy={(text: string) => onCopied(name, text)}> |
|
|
|