Skip to content

Commit 474a42e

Browse files
implement clearer UX for transparent color in color picker (#4111)
* implement clearer ui for transparent color in color picker * svg to inherit color instead of filling gray for better visibility * clean up: remove unnecessary classnames utility --------- Co-authored-by: Leslie Yip <[email protected]>
1 parent 015871f commit 474a42e

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed
Lines changed: 2 additions & 0 deletions
Loading

website/src/views/components/ColorPicker.scss

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ $arrow-height: 1.5rem;
9090

9191
// Add a cross mark to indicate the currently selected color
9292
&.selected::after {
93-
content: '';
9493
position: absolute;
9594
top: 0;
9695
right: 0;
@@ -139,3 +138,11 @@ $arrow-height: 1.5rem;
139138
);
140139
}
141140
}
141+
.transparentIcon {
142+
position: absolute;
143+
top: 50%;
144+
left: 50%;
145+
width: 1rem;
146+
height: 1rem;
147+
transform: translate(-50%, -50%);
148+
}

website/src/views/components/ColorPicker.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import _ from 'lodash';
66
import { ColorIndex } from 'types/timetables';
77
import { NUM_DIFFERENT_COLORS, TRANSPARENT_COLOR_INDEX } from 'utils/colors';
88

9+
import TransparentIcon from 'img/icons/transparent.svg';
910
import styles from './ColorPicker.scss';
1011

1112
type Props = {
@@ -64,7 +65,11 @@ const ColorPicker = memo<Props>((props) => {
6465
className={classnames(styles.option, `color-${index}`, {
6566
[styles.selected]: index === color,
6667
})}
67-
/>
68+
>
69+
{index === color && (
70+
<TransparentIcon className={styles.transparentIcon} fill="currentColor" />
71+
)}
72+
</button>
6873
))}
6974
</div>
7075
</div>

0 commit comments

Comments
 (0)