Skip to content

Commit b97b625

Browse files
committed
refactor: put icons into seperate component
1 parent 8cd0524 commit b97b625

File tree

2 files changed

+40
-40
lines changed

2 files changed

+40
-40
lines changed

example/App.tsx

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import SelectControl from './SelectControl.vue';
55
import Editable from './Editable.vue';
66
// import Tsx from './Tsx';
77
import './styles.less';
8+
import { MoonIcon, SunIcon } from './Icons';
89

910
const list = [
1011
{
@@ -34,46 +35,6 @@ const list = [
3435
// },
3536
];
3637

37-
const SunIcon = () => (
38-
<svg
39-
xmlns="http://www.w3.org/2000/svg"
40-
width="24"
41-
height="24"
42-
viewBox="0 0 24 24"
43-
fill="none"
44-
stroke="currentColor"
45-
strokeWidth="2"
46-
strokeLinecap="round"
47-
strokeLinejoin="round"
48-
>
49-
<circle cx="12" cy="12" r="5"></circle>
50-
<line x1="12" y1="1" x2="12" y2="3"></line>
51-
<line x1="12" y1="21" x2="12" y2="23"></line>
52-
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
53-
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
54-
<line x1="1" y1="12" x2="3" y2="12"></line>
55-
<line x1="21" y1="12" x2="23" y2="12"></line>
56-
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
57-
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
58-
</svg>
59-
);
60-
61-
const MoonIcon = () => (
62-
<svg
63-
xmlns="http://www.w3.org/2000/svg"
64-
width="24"
65-
height="24"
66-
viewBox="0 0 24 24"
67-
fill="none"
68-
stroke="currentColor"
69-
strokeWidth="2"
70-
strokeLinecap="round"
71-
strokeLinejoin="round"
72-
>
73-
<path d="M21 12.79A9 9 0 0112.21 3C11.66 3 11.11 3.05 10.58 3.15A9 9 0 1021 12.79z"></path>
74-
</svg>
75-
);
76-
7738
export default defineComponent({
7839
setup() {
7940
const state = reactive({

example/Icons.tsx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
export const SunIcon = () => (
2+
<svg
3+
xmlns="http://www.w3.org/2000/svg"
4+
width="24"
5+
height="24"
6+
viewBox="0 0 24 24"
7+
fill="none"
8+
stroke="currentColor"
9+
strokeWidth="2"
10+
strokeLinecap="round"
11+
strokeLinejoin="round"
12+
>
13+
<circle cx="12" cy="12" r="5"></circle>
14+
<line x1="12" y1="1" x2="12" y2="3"></line>
15+
<line x1="12" y1="21" x2="12" y2="23"></line>
16+
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
17+
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
18+
<line x1="1" y1="12" x2="3" y2="12"></line>
19+
<line x1="21" y1="12" x2="23" y2="12"></line>
20+
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
21+
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
22+
</svg>
23+
);
24+
25+
export const MoonIcon = () => (
26+
<svg
27+
xmlns="http://www.w3.org/2000/svg"
28+
width="24"
29+
height="24"
30+
viewBox="0 0 24 24"
31+
fill="none"
32+
stroke="currentColor"
33+
strokeWidth="2"
34+
strokeLinecap="round"
35+
strokeLinejoin="round"
36+
>
37+
<path d="M21 12.79A9 9 0 0112.21 3C11.66 3 11.11 3.05 10.58 3.15A9 9 0 1021 12.79z"></path>
38+
</svg>
39+
);

0 commit comments

Comments
 (0)