UNPKG

styled-components

Version:

Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress 💅

17 lines (13 loc) • 509 B
// @flow type Props = { theme?: any, } export default (props: Props, fallbackTheme: any, defaultProps: any) => { // Props should take precedence over ThemeProvider, which should take precedence over // defaultProps, but React automatically puts defaultProps on props. /* eslint-disable react/prop-types */ const isDefaultTheme = defaultProps && props.theme === defaultProps.theme const theme = props.theme && !isDefaultTheme ? props.theme : fallbackTheme /* eslint-enable */ return theme }