Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix get #41

Open
tko22 opened this issue May 11, 2020 · 0 comments
Open

Fix get #41

tko22 opened this issue May 11, 2020 · 0 comments
Labels
bug Something isn't working component for component dev issues

Comments

@tko22
Copy link
Member

tko22 commented May 11, 2020

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})
@tko22 tko22 added bug Something isn't working component for component dev issues labels May 11, 2020
@tko22 tko22 assigned tko22 and unassigned tko22 May 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working component for component dev issues
Projects
None yet
Development

No branches or pull requests

1 participant