Skip to content

Commit 943b7de

Browse files
authored
fix(copy): change default copy icon (#499)
* fix(copy): change default copy icon * fix(copy): change default copy icon
1 parent 5d7ea1a commit 943b7de

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

src/copy/index.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React, { CSSProperties, ReactNode } from 'react';
2-
import { CopyOutlined } from '@ant-design/icons';
32
import { message, Tooltip } from 'antd';
43
import classNames from 'classnames';
54
import useClippy from 'use-clippy';
@@ -16,9 +15,25 @@ export interface ICopyProps {
1615
onCopy?: (text: string) => void;
1716
}
1817

18+
// 后续迁移了 icon 库之后,可以直接从 icon 中引入
19+
const CopyIcon = () => (
20+
<span className="dtc-copy__default-icon">
21+
<svg
22+
viewBox="0 0 1024 1024"
23+
version="1.1"
24+
xmlns="http://www.w3.org/2000/svg"
25+
width="1em"
26+
height="1em"
27+
fill="currentColor"
28+
>
29+
<path d="M704 96a96 96 0 0 1 96 96v16h32a96 96 0 0 1 96 96v512a96 96 0 0 1-96 96H320a96 96 0 0 1-96-96v-16h-32a96 96 0 0 1-95.936-92.4L96 704V192a96 96 0 0 1 96-96z m96 608a96 96 0 0 1-96 96H288v16a32 32 0 0 0 32 32h512a32 32 0 0 0 32-32V304a32 32 0 0 0-32-32h-32z m-96-544H192a32 32 0 0 0-32 32v512a32 32 0 0 0 32 32h512a32 32 0 0 0 32-32V192a32 32 0 0 0-32-32z m-256 64a32 32 0 0 1 32 32v160h160a32 32 0 1 1 0 64H480v160a32 32 0 1 1-64 0V480H256a32 32 0 1 1 0-64h160V256a32 32 0 0 1 32-32z"></path>
30+
</svg>
31+
</span>
32+
);
33+
1934
const Copy: React.FC<ICopyProps> = (props) => {
2035
const {
21-
button = <CopyOutlined className="dtc-copy__default-icon" />,
36+
button = <CopyIcon />,
2237
text,
2338
tooltip = '复制',
2439
style,

src/copy/style.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.dtc-copy {
22
display: inline-block;
33
cursor: pointer;
4-
&__default-icon:hover {
5-
color: #58ABF9;
4+
&__default-icon {
5+
color: #1D78FF;
66
}
77
}

0 commit comments

Comments
 (0)