mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-25 08:43:57 +08:00
18 lines
637 B
JavaScript
18 lines
637 B
JavaScript
import * as React from 'react';
|
|
import CopyToClipboard from 'react-copy-to-clipboard';
|
|
import { Icon as AntdIcon, Badge } from 'antd';
|
|
const Icon = AntdIcon;
|
|
const CopyableIcon = ({ type, theme, isNew, justCopied, onCopied, }) => {
|
|
return (<CopyToClipboard text={`<Icon type="${type}" theme="${theme}" />`} onCopy={() => onCopied(type)}>
|
|
<li className={justCopied === type ? 'copied' : ''}>
|
|
<Icon type={type} theme={theme}/>
|
|
<span className="anticon-class">
|
|
<Badge dot={isNew}>
|
|
{type}
|
|
</Badge>
|
|
</span>
|
|
</li>
|
|
</CopyToClipboard>);
|
|
};
|
|
export default CopyableIcon;
|