Skip to content

Commit 3c02cf1

Browse files
committed
client/modules/App/components/ThemeProvider: update types and to named export
1 parent 5e5a508 commit 3c02cf1

2 files changed

Lines changed: 7 additions & 13 deletions

File tree

client/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { useTranslation } from 'react-i18next';
77
import browserHistory from './browserHistory';
88
import { setupStore } from './store';
99
import Routing from './routes';
10-
import ThemeProvider from './modules/App/components/ThemeProvider';
10+
import { ThemeProvider } from './modules/App/components/ThemeProvider';
1111
import Loader from './modules/App/components/loader';
1212
import './i18n';
1313
import { SkipLink } from './components/SkipLink';
Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
import React from 'react';
2-
import PropTypes from 'prop-types';
32
import { useSelector } from 'react-redux';
4-
import { ThemeProvider } from 'styled-components';
3+
import { ThemeProvider as TProvider } from 'styled-components';
54
import theme from '../../../theme';
5+
import type { RootState } from '../../../reducers';
66

7-
const Provider = ({ children }) => {
8-
const currentTheme = useSelector((state) => state.preferences.theme);
9-
return (
10-
<ThemeProvider theme={{ ...theme[currentTheme] }}>{children}</ThemeProvider>
7+
export const ThemeProvider = ({ children }: { children: React.ReactNode }) => {
8+
const currentTheme = useSelector(
9+
(state: RootState) => state.preferences.theme
1110
);
11+
return <TProvider theme={{ ...theme[currentTheme] }}>{children}</TProvider>;
1212
};
13-
14-
Provider.propTypes = {
15-
children: PropTypes.node.isRequired
16-
};
17-
18-
export default Provider;

0 commit comments

Comments
 (0)