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

Dynamic styled(component) by passing component as prop #2784

Closed
samueldepooter opened this issue Jan 19, 2018 · 1 comment
Closed

Dynamic styled(component) by passing component as prop #2784

samueldepooter opened this issue Jan 19, 2018 · 1 comment

Comments

@samueldepooter
Copy link

Issue details

Created a generic styled component, for example Icon. Then I'm passing a component as a prop to the styled component. In the styled component, I write a function that takes out the component prop (containing my component) and returns it. I expect it to use this component to apply the styled component to but instead it does not apply anything.

Steps to reproduce

  1. Create a styled component that takes a prop containing a component and return it.
const Icon = styled(({ component }) => component)`
  background: red;
`
  1. Use the styled component in your render & pass it a 'component' prop.
<Icon component={<MyCustomIco fill={color} width={size} height={size} />} />
  1. The outcome should be that the style is applied to

Please specify which version of Storybook and optionally any affected addons that you're running

  • @storybook/react ^3.2.18
  • @storybook/addon-actions ^3.2.18
  • @storybook/addon-knobs ^3.2.18
  • @storybook/addon-links ^3.2.18
  • @storybook/addons ^3.2.18

Affected platforms

Not relevant.

Screenshots / Screencast / Code Snippets (Optional)

screen shot 2018-01-19 at 14 31 33

screen shot 2018-01-19 at 14 31 42

@samueldepooter
Copy link
Author

Wrong repo... 😅

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant