2016-03-31 17:46:35 +08:00
|
|
|
import React from 'react';
|
|
|
|
import CopyToClipboard from 'react-copy-to-clipboard';
|
2017-09-05 17:13:46 +08:00
|
|
|
import { Icon, Badge } from 'antd';
|
2016-03-31 17:46:35 +08:00
|
|
|
|
2018-07-27 19:39:45 +08:00
|
|
|
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>
|
|
|
|
);
|
2018-06-22 21:05:13 +08:00
|
|
|
|
2018-07-27 19:39:45 +08:00
|
|
|
export default CopyableIcon;
|