Skip to content

Fix get #41

@tko22

Description

@tko22

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

  1. 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)
  2. in any object literal syntax not styled.div or whatever do get(key)(props) where props.theme is the theme... However, we've been converting the theme passed in as props as propTheme 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

No one assigned

    Labels

    bugSomething isn't workingcomponentfor component dev issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions