question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enhance Stories to Use Storybook Theming Functionality

See original GitHub issue

The ability to view Storybook stories with different themes was added in https://github.com/grommet/grommet/pull/5674.

We need to make adjustments to the stories component by component to take advantage of the theming ability. The Button stories are currently using this enhancement and can be viewed on storybook. While on a Button story you can change the theme by selecting the ‘Theme’ button in the top bar above the story and then selecting a theme from the drop down. Notice the stories changes style when you switch themes. We want to add this feature to all the stories.

For each story within a component if the story…

  1. Is wrapped with <Grommet theme={grommet}>...</Grommet> – remove <Grommet theme={grommet}> and replace with the following comment: // Uncomment <Grommet> lines when using outside of storybook // <Grommet theme={...}> – comment out </Grommet> – remove import { Grommet } and import { grommet }
  2. Uses a custom theme – create a CustomThemed folder directly under the component/stories folder – move the story into the CustomThemed folder – change the story export so that it shows up in a ‘Custom Themed’ folder within storybook. (Example: export default { title: 'Controls/Button/Custom Themed/Active' };)

For examples take a look at https://github.com/grommet/grommet/pull/5674. The Button/stories/Basic.js file shows an example of a story wrapped with <Grommet theme={grommet}>. The Button/stories/CustomThemed/Active.js shows an example of a story that uses a custom theme.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
jcfilbencommented, Mar 2, 2022

All applicable stories have been enhanced to allow theme switching. Thank you to everyone that helped with this issue!

1reaction
jcfilbencommented, Feb 28, 2022

Yes as I expected. But which prop name should we use to pass the options?

I think we can just call the prop options

Read more comments on GitHub >

github_iconTop Results From Across the Web

Theming - Storybook
The easiest way to customize Storybook is to generate a new theme using the create() function from storybook/theming . This function includes shorthands...
Read more >
Theming Storybook
The easiest way to customize Storybook is to generate a new theme using the create() function from storybook/theming . This function includes shorthands...
Read more >
Customising Storybook with your brand colors + Dark Mode
Storybook is a great tool to develop components and share previews with. your client and UI teams.In this video, we're going to learn...
Read more >
Component-Driven Theming with Storybook - YouTube
This session explores component-driven theming using the Emulsify ... as show examples of how Storybook and its add-ons can help increase ...
Read more >
storybook-facelift - npm
Easy to use · Customize Storybook features · Enhanced UI for Storybook · Automatic Theme Providers with Material UI and Styled Components.
Read more >

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Hashnode Post

No results found