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