-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
bugSomething isn't workingSomething isn't workingcomponentfor component dev issuesfor component dev issues
Description
get
is a HOC over themeGet
provided by styled-system... themeGet has the API of
themeGet(objectPath, fallbackValue)(props)
it takes props as a value and gets props.theme...
get
just defaults with the default theme...
However, with the way we've been using it outside styled-components (not tagged template literal) and in object literal syntax, it will always fallback the default theme ignoring the passed theme, if it exists...
So, we should
- test components changing styles for passed themes via props ( does that automatically if one would use it so we don't have to worry about that)
- in any object literal syntax not
styled.div or whatever
doget(key)(props)
whereprops.theme
is the theme... However, we've been converting thetheme
passed in as props aspropTheme
since it conflicts with the default theme we import in components... Thus, we should alias default theme we import in as defaultTheme (since we use it once) -
import {default as defaultTheme} from '../theme'
then whenever we deconstruct props for the component, we leave it as theme
, instead of aliasing it to propTheme
as such:
const Button = ({theme, ...props}){
}
// instead of ({theme: propTheme, ...props})
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcomponentfor component dev issuesfor component dev issues