Skip to content

Commit bb3f0f5

Browse files
committed
Convert Icon to CSS modules
1 parent 092ed8a commit bb3f0f5

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

ui/frontend/Icon.module.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.icon {
2+
display: block;
3+
fill: currentColor;
4+
}

ui/frontend/Icon.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,36 @@
11
import React from 'react';
22

3+
4+
import styles from './Icon.module.css';
5+
36
/* eslint-disable max-len */
47

58
// These icons came from Material Design originally
69
// https://material.io/tools/icons/?icon=assignment&style=outline
710

811
// M.D. 'play_arrow'
912
export const BuildIcon = () => (
10-
<svg className="icon" height="14" viewBox="8 4 10 16" width="12" xmlns="http://www.w3.org/2000/svg">
13+
<svg className={styles.icon} height="14" viewBox="8 4 10 16" width="12" xmlns="http://www.w3.org/2000/svg">
1114
<path d="M8 5v14l11-7z" />
1215
</svg>
1316
);
1417

1518
// M.D. 'keyboard_arrow_down'
1619
export const ExpandableIcon = () => (
17-
<svg className="icon" height="10" viewBox="6 8 12 8" width="10" opacity="0.5" xmlns="http://www.w3.org/2000/svg">
20+
<svg className={styles.icon} height="10" viewBox="6 8 12 8" width="10" opacity="0.5" xmlns="http://www.w3.org/2000/svg">
1821
<path d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z" />
1922
</svg>
2023
);
2124

2225
// M.D. 'more_horiz'
2326
export const MoreOptionsIcon = () => (
24-
<svg className="icon" height="18" viewBox="0 0 24 24" width="18" opacity="0.5" xmlns="http://www.w3.org/2000/svg">
27+
<svg className={styles.icon} height="18" viewBox="0 0 24 24" width="18" opacity="0.5" xmlns="http://www.w3.org/2000/svg">
2528
<path d="M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" />
2629
</svg>
2730
);
2831

2932
export const MoreOptionsActiveIcon = () => (
30-
<svg className="icon" height="18" viewBox="0 0 24 24" width="18" xmlns="http://www.w3.org/2000/svg">
33+
<svg className={styles.icon} height="18" viewBox="0 0 24 24" width="18" xmlns="http://www.w3.org/2000/svg">
3134
<g fillRule="evenodd" fill="#428bca">
3235

3336
<path d="M4,5 h16 a3,3 0 0,1 3,3 v8 a3,3 0 0,1 -3,3 h-16 a3,3 0 0,1 -3,-3 v-8 a3,3 0 0,1 3,-3 Z
@@ -38,27 +41,27 @@ export const MoreOptionsActiveIcon = () => (
3841

3942
// M.D. 'settings',
4043
export const ConfigIcon = () => (
41-
<svg className="icon" height="15" viewBox="0 0 24 24" width="15" opacity="0.5" xmlns="http://www.w3.org/2000/svg">
44+
<svg className={styles.icon} height="15" viewBox="0 0 24 24" width="15" opacity="0.5" xmlns="http://www.w3.org/2000/svg">
4245
<path d="M19.43 12.98c.04-.32.07-.64.07-.98s-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.3-.61-.22l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65C14.46 2.18 14.25 2 14 2h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.23-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98s.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.23.09.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.65zM12 15.5c-1.93 0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5 3.5 1.57 3.5 3.5-1.57 3.5-3.5 3.5z" />
4346
</svg>
4447
);
4548

4649
// M.D. 'help_outline'
4750
export const HelpIcon = () => (
48-
<svg className="icon" height="18" viewBox="0 0 24 24" width="18" opacity="0.5" xmlns="http://www.w3.org/2000/svg">
51+
<svg className={styles.icon} height="18" viewBox="0 0 24 24" width="18" opacity="0.5" xmlns="http://www.w3.org/2000/svg">
4952
<path d="M11 18h2v-2h-2v2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4z" />
5053
</svg>
5154
);
5255

5356
export const CheckmarkIcon = () => (
54-
<svg className="icon icon--checkmark" height="18" viewBox="2 2 22 22" width="18" opacity="0.5" xmlns="http://www.w3.org/2000/svg">
57+
<svg className={styles.icon} height="18" viewBox="2 2 22 22" width="18" opacity="0.5" xmlns="http://www.w3.org/2000/svg">
5558
<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" />
5659
</svg>
5760
);
5861

5962
// M.D. 'assignment' (outline)
6063
export const ClipboardIcon = () => (
61-
<svg className="icon" height="18" width="18" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
64+
<svg className={styles.icon} height="18" width="18" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
6265
<rect x="7" y="15" width="7" height="2" />
6366
<rect x="7" y="11" width="10" height="2" />
6467
<rect x="7" y="7" width="10" height="2" />
@@ -68,7 +71,7 @@ export const ClipboardIcon = () => (
6871

6972
// M.D. 'close'
7073
export const Close = () => (
71-
<svg className="icon" width="24px" height="24px" viewBox="0 0 24 24">
74+
<svg className={styles.icon} width="24px" height="24px" viewBox="0 0 24 24">
7275
<path d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41z" />
7376
</svg>
7477
);

ui/frontend/index.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -648,11 +648,6 @@ $header-transition: 0.2s ease-in-out;
648648
}
649649
}
650650

651-
.icon {
652-
display: block;
653-
fill: currentColor;
654-
}
655-
656651
.notifications {
657652
position: absolute;
658653
z-index: 10;

0 commit comments

Comments
 (0)