mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-05-04 15:13:43 +03:00
20 lines
556 B
JavaScript
20 lines
556 B
JavaScript
import styled from 'styled-components';
|
|
import getDefaultTheme from '../themes/default';
|
|
|
|
const getStyle = (styles, type) =>
|
|
typeof styles === 'object' ? styles[type] || styles.default : styles;
|
|
|
|
export default (styles, component) =>
|
|
styled(component || 'div')`
|
|
${props =>
|
|
props.theme.type
|
|
? getStyle(styles, props.theme.type)
|
|
: // used outside of container (theme provider)
|
|
getStyle(styles, 'default')({
|
|
...props,
|
|
theme: getDefaultTheme(props.theme)
|
|
})}
|
|
`;
|
|
|
|
// TODO: memoize it?
|