Using media queries in decorators
See original GitHub issueI have the following decorator in my stories:
export default {
title: 'Components/Button',
decorators: [storyFn => <div style={{ backgroundColor: 'black', padding: '24px' }}>{storyFn()}</div>],
};
This is because the elements support dark mode out of the box so need a black background when displayed in the Docs…
However I only want this when in Dark Mode…
So I need something like:
export default {
title: 'Components/Button',
decorators: [storyFn => <div style={{ @media(prefers-color-scheme: dark) { backgroundColor: 'black', } padding: '24px' }}>{storyFn()}</div>],
};
But it doesn’t like that syntax (obviously)… how can you add media queries into the decorator?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
Media Query Decorator › zzzzBov.com - Blag
Media Query Decorator · TypeScript supports decorators which are very convenient for adding complex functionality to classes in a declarative ...
Read more >Fundamentals / Media Queries - Page ⋅ Storybook
Media queries allow us to create responsive experiences by changing the look and feel of a component based on the given media query....
Read more >Using media queries - CSS: Cascading Style Sheets | MDN
A media query computes to true when the media type (if specified) matches the device on which a document is being displayed and...
Read more >Styled-component and Material component (Media queries)
I have some difficulty to understand media queries with MUI and styled component. I understand that this following syntax is from styled- ...
Read more >The Best Way to Facilitate CSS Media Queries using SCSS ...
This article will explain how to create media queries using SCSS mixins. It will also show how to use the @include function to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
😬 pretty please? ❤️
Did you manage to solve this issue?