Skip to content

Commit c2734ab

Browse files
committed
Send current theme variables directly into provider
1 parent 1e5e47a commit c2734ab

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

Diff for: client/index.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const store = configureStore(initialState);
2222
const currentTheme = Theme.light;
2323

2424
const App = () => (
25-
<ThemeProvider theme={{ ...theme, current: theme[currentTheme] }}>
25+
<ThemeProvider theme={{ ...theme[currentTheme] }}>
2626
<Provider store={store}>
2727
<Router history={history} routes={routes(store)} />
2828
</Provider>

Diff for: client/theme.js

+20-6
Original file line numberDiff line numberDiff line change
@@ -15,40 +15,54 @@ export const common = {
1515

1616
export const remSize = size => `${size / common.baseFontSize}rem`;
1717

18-
export const prop = key => props => props.theme[key];
18+
export const prop = key => (props) => {
19+
const value = props.theme[key];
20+
21+
if (value == null) {
22+
throw new Error(`themed prop ${key} not found`);
23+
}
24+
25+
return value;
26+
};
1927

2028
export default {
2129
[Theme.light]: {
2230
colors,
2331
...common,
2432
primaryTextColor: '#333',
2533

26-
buttonColor: '#f10046',
27-
buttonColorBackground: '#fff',
34+
buttonColor: '#000',
35+
buttonColorBackground: '#f4f4f4',
2836
buttonBorderColor: '#b5b5b5',
2937
buttonHoverColor: '#fff',
3038
buttonHoverColorBackground: colors.p5pink,
39+
buttonDisabledColor: '#f10046',
40+
buttonDisabledColorBackground: '#fff',
3141
},
3242
[Theme.dark]: {
3343
colors,
3444
...common,
3545
primaryTextColor: '#FFF',
3646

37-
buttonColor: '#f10046',
38-
buttonColorBackground: '#fff',
47+
buttonColor: '#000',
48+
buttonColorBackground: '#f4f4f4',
3949
buttonBorderColor: '#b5b5b5',
4050
buttonHoverColor: '#fff',
4151
buttonHoverColorBackground: colors.p5pink,
52+
buttonDisabledColor: '#f10046',
53+
buttonDisabledColorBackground: '#fff',
4254
},
4355
[Theme.contrast]: {
4456
colors,
4557
...common,
4658
primaryTextColor: '#F5DC23',
4759

48-
buttonColor: '#333',
60+
buttonColor: '#000',
4961
buttonColorBackground: colors.yellow,
5062
buttonBorderColor: '#b5b5b5',
5163
buttonHoverColor: '#333',
5264
buttonHoverColorBackground: '#fff',
65+
buttonDisabledColor: '#333',
66+
buttonDisabledColorBackground: colors.yellow,
5367
},
5468
};

0 commit comments

Comments
 (0)