Skip to content

Commit 03866ad

Browse files
authored
fix: dark mode colors (#301)
* update shadows * update shadows, use dark-mode extension colors * fix dropdown bg * fix dropdown-button bg * fix sizing issue for `<GetIcon />` * refactor `IconButton` * fix list background
1 parent b71d105 commit 03866ad

File tree

9 files changed

+49
-67
lines changed

9 files changed

+49
-67
lines changed

src/components/dropdown-button/styles.ts

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export default {
44
cursor: 'pointer',
55
marginTop: '-2px',
66
width: 'fit-content',
7+
background: 'white',
78
},
89
dropdown: (height: number | undefined, alignLeft: boolean) => ({
910
position: 'absolute',

src/components/dropdown/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const Dropdown: FC<DropdownProps> = ({
5555
disabled={disabled}
5656
>
5757
<Flex width="100%">
58-
<Flex flexGrow={1}>
58+
<Flex flexGrow={1} color="black">
5959
{icon && (
6060
<GetIcon
6161
color={disabled ? 'gray' : 'black'}

src/components/icon-button/icon-button.stories.tsx

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React from 'react';
21
import { action } from '@storybook/addon-actions';
3-
import { Story, Meta } from '@storybook/react/types-6-0';
2+
import { Meta, Story } from '@storybook/react/types-6-0';
3+
import React from 'react';
44

55
import IconButton, { IconButtonProps } from '.';
66
import { IconName } from '../icon/list';
@@ -15,7 +15,7 @@ const Template: Story<IconButtonProps> = (props) => <IconButton {...props} />;
1515
export const IconButtons = Template.bind({});
1616

1717
IconButtons.args = {
18-
icon: IconName.eye,
18+
icon: IconName.more,
1919
intent: 'primary',
2020
tooltip: 'Tooltip',
2121
onClick: action('onClick'),
@@ -56,12 +56,13 @@ IconButtons.argTypes = {
5656
},
5757
},
5858
icon: {
59-
control: {
60-
disable: true,
61-
},
62-
type: {
63-
required: true,
64-
summary: 'Use an icon from IconName. E.g. IconName.glass',
59+
control: { type: 'select' },
60+
options: ['more', 'card', 'birth', 'lock'],
61+
mapping: {
62+
download: IconName.more,
63+
card: IconName.card,
64+
birth: IconName.birth,
65+
lock: IconName.lock,
6566
},
6667
},
6768
};
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,8 @@
1-
import { SxStyleProp } from 'rebass';
2-
3-
export default (disabled: boolean): SxStyleProp => ({
1+
export const wrapper = {
42
display: 'flex',
53
alignItems: 'center',
64
justifyContent: 'center',
75

86
height: '32px',
97
width: '32px',
10-
position: 'relative',
11-
12-
borderWidth: '1px',
13-
borderStyle: 'solid',
14-
borderRadius: 0,
15-
16-
boxSizing: 'border-box',
17-
18-
outline: 'none',
19-
cursor: 'pointer',
20-
21-
transition: ({ transitions }) => transitions.button,
22-
23-
':disabled': {
24-
cursor: 'default',
25-
pointerEvents: 'none',
26-
},
27-
28-
'> svg': {
29-
width: '16px',
30-
height: '16px',
31-
position: 'absolute',
32-
path: { fill: disabled ? 'gray' : 'black' },
33-
},
34-
});
8+
};

src/components/icon-button/index.tsx

+18-15
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
import React, { FC } from 'react';
2-
import { Button as RebassButton, ButtonProps } from 'rebass';
32
import { Link } from 'react-router-dom';
3+
import { ButtonProps } from 'rebass';
44

55
// Components
66
import Tooltip, { TooltipProps } from '../tooltip';
77

8-
import { getIcon, IconName } from '../icon/list';
9-
import styles from './icon-button.styles';
8+
import { Button } from '../button';
9+
import GetIcon from '../icon/GetIcon';
10+
import { IconName } from '../icon/list';
11+
12+
import * as S from './icon-button.styles';
1013

1114
export interface IconButtonProps extends Omit<ButtonProps, 'css'> {
12-
intent?: 'primary' | 'ghost' | 'ghost-white';
15+
intent?: 'primary' | 'ghost' | 'ghost-white'; // TODO remove this intent, not used
1316
tooltip?: string;
1417
icon: IconName;
1518
disabled?: boolean;
@@ -19,8 +22,8 @@ export interface IconButtonProps extends Omit<ButtonProps, 'css'> {
1922
}
2023

2124
const IconButton: FC<IconButtonProps> = ({
25+
intent: _, // TODO remove this
2226
tooltip,
23-
intent = 'primary',
2427
icon,
2528
disabled = false,
2629
tooltipProps,
@@ -34,26 +37,26 @@ const IconButton: FC<IconButtonProps> = ({
3437
if (tooltip) {
3538
component = (
3639
<Tooltip {...tooltipProps} disabled={disabled} mainText={tooltip}>
37-
<RebassButton
38-
sx={{ ...styles(disabled), ...sx }}
39-
variant={`icon-${intent}`}
40+
<Button
41+
sx={{ ...S.wrapper, ...sx }}
42+
variant="secondary"
4043
disabled={disabled}
4144
{...props}
4245
>
43-
{getIcon(icon, 'black')}
44-
</RebassButton>
46+
<GetIcon disabled={disabled} icon={icon} size="sm" />
47+
</Button>
4548
</Tooltip>
4649
);
4750
} else {
4851
component = (
49-
<RebassButton
50-
sx={styles(disabled)}
51-
variant={`icon-${intent}`}
52+
<Button
53+
sx={{ ...S.wrapper, ...sx }}
54+
variant="secondary"
5255
disabled={disabled}
5356
{...props}
5457
>
55-
{getIcon(icon, 'black')}
56-
</RebassButton>
58+
<GetIcon disabled={disabled} icon={icon} size="sm" />
59+
</Button>
5760
);
5861
}
5962

src/components/icon/GetIcon.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ const GetIcon: FC<GetIconProps> = ({
2525
<Flex
2626
{...props}
2727
sx={{
28+
minWidth: iconSize,
29+
height: 'auto',
2830
svg: {
2931
width: iconSize,
3032
height: iconSize,

src/components/list/container/index.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const List = forwardRef<HTMLUListElement, ListProps>(
1717
{...props}
1818
tx="variants.list"
1919
variant="container"
20+
color="black"
2021
>
2122
{children}
2223
</Box>

src/components/list/item/list-item.styles.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ export const withoutBorder = { borderBottomColor: 'transparent' };
33
export default (isActive: boolean, disablde?: boolean) => ({
44
height: '35px',
55

6-
bg: isActive ? 'grayShade3' : 'initial',
7-
color: disablde ? 'gray' : 'initial',
6+
bg: isActive ? 'grayShade3' : 'inherit',
7+
color: disablde ? 'gray' : 'inherit',
88

99
display: 'flex',
1010
alignItems: 'center',

src/theme/theme.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,12 @@ const defaultTheme: ITheme = {
175175
};
176176

177177
const darkThemeColors: ITheme['colors'] = {
178-
white: '#303030',
178+
white: '#181a1b',
179179

180180
gray: '#A6A6A6',
181181
grayShade1: '#707070',
182182
grayShade2: '#4D4D4D',
183-
grayShade3: '#222222',
183+
grayShade3: '#1e2021',
184184

185185
black: '#F0F0F0',
186186

@@ -205,16 +205,16 @@ const darkThemeColors: ITheme['colors'] = {
205205
};
206206

207207
const darkThemeShadows: ITheme['shadows'] = {
208-
primary: '0px 5px 15px rgba(61, 245, 187, 0.2)',
209-
secondary: '0px 5px 15px rgba(230, 230, 230, 0.2)',
210-
explorer: '0px -1px 1px #A7A7A7',
211-
alert: '0px 5px 15px rgba(255, 102, 102, 0.25)',
212-
disabled: '0px 4px 15px rgba(255, 255, 255, 0.25)',
213-
cardInsetShadow: 'inset 0px -20px 30px -25px rgba(255, 255, 255, 0.15)',
214-
navigation: '1px 0px 0px #4D4D4D, 2px 0px 0px white',
215-
list: '0px 4px 15px rgba(255, 255, 255, 0.25)',
216-
popup: '0px 4px 4px rgba(255, 255, 255, 0.25)',
217-
notification: '0px 0px 15px rgba(255, 255, 255, 0.25)',
208+
primary: '0 0 1px 2px rgba(160, 160, 160, 0.1)',
209+
secondary: '0 0 1px 2px rgba(160, 160, 160, 0.1)',
210+
explorer: '0 0 1px 2px rgba(160, 160, 160, 0.1)',
211+
alert: '0 0 1px 2px rgba(160, 160, 160, 0.1)',
212+
disabled: '0 0 1px 2px rgba(160, 160, 160, 0.1)',
213+
cardInsetShadow: '0 0 1px 2px rgba(160, 160, 160, 0.1)',
214+
navigation: '0 0 1px 2px rgba(160, 160, 160, 0.1)',
215+
list: '0 0 1px 2px rgba(160, 160, 160, 0.1)',
216+
popup: '0 0 1px 2px rgba(160, 160, 160, 0.1)',
217+
notification: '0 0 1px 2px rgba(160, 160, 160, 0.1)',
218218
};
219219

220220
export const useTheme = () => useEmotionTheme<ITheme>();

0 commit comments

Comments
 (0)