0.1.6 • Published 7 years ago

react-redux-theme-provider v0.1.6

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

react-redux-theme-provider

npm

React helpers for theming components. Works great with inline styles or any css-in-js library.

Installation

React 15.3.0 and Redux 3.0.0 or later are peer dependencies.

npm install --save react-redux-theme-provider

Usage

// MyApp.js

import { withTheme, ThemeProvider } from 'react-redux-theme-provider'

function MyApp({ theme }) {
  return (
    <ThemeProvider theme={theme}>
      <MyThemedComponent />
    </ThemeProvider>
  )
}

// theme variables
export default withTheme({
  primaryColor: 'blue'
})

// or theme variables as a function of props
export default withTheme(props => {
  primaryColor: props.primaryColor
})
// MyThemedComponent.js

import { withStyles } from 'react-redux-theme-provider'

function MyThemedComponent({ styles }) {
  return (
    <div style={styles.base} />
  )
}

export default withStyles(theme => ({
  base: {
    background: theme.primaryColor
  }
}))(MyThemedComponent)
0.1.6

7 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.1

8 years ago