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 11import React from 'react' ;
22import PropTypes from 'prop-types' ;
3- import { connect } from 'react-redux' ;
3+ import { useSelector } from 'react-redux' ;
44import { ThemeProvider } from 'styled-components' ;
5+ import theme from '../../../theme' ;
56
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+ } ;
1113
1214Provider . propTypes = {
13- children : PropTypes . node . isRequired ,
14- currentTheme : PropTypes . oneOf ( Object . keys ( Theme ) ) . isRequired
15+ children : PropTypes . node . isRequired
1516} ;
1617
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