Skip to content

Commit 7664cbc

Browse files
committed
progress dark mode
1 parent 60bed61 commit 7664cbc

File tree

2 files changed

+95
-0
lines changed

2 files changed

+95
-0
lines changed

constants/componentColors.ts

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export default {
1111
button: {
1212
disabledColor: '#d8d8d8',
1313
disabledTextColor: theme.gray100,
14+
inverseColor: theme.white,
1415
},
1516
textInput: {
1617
backgroundColor: theme.white,
@@ -31,4 +32,71 @@ export default {
3132
closeIconColor: theme.danger,
3233
selectionBackgroundColor: theme.white,
3334
},
35+
light: {
36+
layout: {
37+
backgroundColor: theme.white100,
38+
},
39+
topNav: {
40+
backgroundColor: theme.white,
41+
borderColor: '#c0c0c0',
42+
color: theme.black,
43+
},
44+
button: {
45+
disabledColor: '#d8d8d8',
46+
disabledTextColor: theme.gray100,
47+
inverseColor: theme.white,
48+
},
49+
textInput: {
50+
backgroundColor: theme.white,
51+
borderColor: '#d8d8d8',
52+
onFocusborderColor: '#c0c0c0',
53+
},
54+
checkBox: {
55+
checkedColor: theme.primary,
56+
uncheckedColor: '#d8d8d8',
57+
disabledColor: '#d8d8d8',
58+
},
59+
picker: {
60+
backgroundColor: theme.white,
61+
borderColor: '#d8d8d8',
62+
iconColor: theme.gray300,
63+
placeholderColor: theme.gray300,
64+
labelColor: theme.black,
65+
closeIconColor: theme.danger,
66+
selectionBackgroundColor: theme.white,
67+
},
68+
},
69+
dark: {
70+
layout: {
71+
backgroundColor: '#181A20',
72+
},
73+
topNav: {
74+
backgroundColor: '#262A34',
75+
borderColor: '#2B2D34',
76+
color: theme.white,
77+
},
78+
button: {
79+
disabledColor: '#d8d8d8',
80+
disabledTextColor: theme.gray100,
81+
},
82+
textInput: {
83+
backgroundColor: theme.white,
84+
borderColor: '#d8d8d8',
85+
onFocusborderColor: '#c0c0c0',
86+
},
87+
checkBox: {
88+
checkedColor: theme.primary,
89+
uncheckedColor: '#d8d8d8',
90+
disabledColor: '#d8d8d8',
91+
},
92+
picker: {
93+
backgroundColor: theme.white,
94+
borderColor: '#d8d8d8',
95+
iconColor: theme.gray300,
96+
placeholderColor: theme.gray300,
97+
labelColor: theme.black,
98+
closeIconColor: theme.danger,
99+
selectionBackgroundColor: theme.white,
100+
},
101+
},
34102
};

provider/ThemeProvider.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React from 'react';
2+
import useCachedResources from '../hooks/useCachedResources';
3+
4+
type ContextProps = {
5+
theme: 'light' | 'dark';
6+
setTheme: (val: 'light' | 'dark') => void;
7+
};
8+
9+
const ThemeContext = React.createContext<ContextProps>({
10+
theme: 'light',
11+
setTheme: (theme) => console.warn('no theme provider'),
12+
});
13+
14+
const useTheme = () => React.useContext(ThemeContext);
15+
16+
const ThemeProvider: React.FC = (props) => {
17+
const [theme, setTheme] = React.useState<'light' | 'dark'>('light');
18+
const isLoadingComplete = useCachedResources();
19+
20+
return (
21+
<ThemeContext.Provider value={{ theme: theme, setTheme }}>
22+
{!isLoadingComplete ? null : props.children}
23+
</ThemeContext.Provider>
24+
);
25+
};
26+
27+
export { ThemeProvider, ThemeContext, useTheme, ContextProps };

0 commit comments

Comments
 (0)