File tree Expand file tree Collapse file tree 1 file changed +10
-15
lines changed
client/modules/App/components Expand file tree Collapse file tree 1 file changed +10
-15
lines changed Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import PropTypes from 'prop-types' ;
3
- import { connect } from 'react-redux' ;
3
+ import { useSelector } from 'react-redux' ;
4
4
import { ThemeProvider } from 'styled-components' ;
5
+ import theme from '../../../theme' ;
5
6
6
- import theme , { Theme } from '../../../theme' ;
7
-
8
- const Provider = ( { children, currentTheme } ) => (
9
- < ThemeProvider theme = { { ...theme [ currentTheme ] } } > { children } </ ThemeProvider >
10
- ) ;
7
+ const Provider = ( { children } ) => {
8
+ const currentTheme = useSelector ( ( state ) => state . preferences . theme ) ;
9
+ return (
10
+ < ThemeProvider theme = { { ...theme [ currentTheme ] } } > { children } </ ThemeProvider >
11
+ ) ;
12
+ } ;
11
13
12
14
Provider . propTypes = {
13
- children : PropTypes . node . isRequired ,
14
- currentTheme : PropTypes . oneOf ( Object . keys ( Theme ) ) . isRequired
15
+ children : PropTypes . node . isRequired
15
16
} ;
16
17
17
- function mapStateToProps ( state ) {
18
- return {
19
- currentTheme : state . preferences . theme
20
- } ;
21
- }
22
-
23
- export default connect ( mapStateToProps ) ( Provider ) ;
18
+ export default Provider ;
You can’t perform that action at this time.
0 commit comments