Add ability to target a specific viewport in CSS #25898
jasonsperske
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is your feature request related to a problem? Please describe.
I am using storybook to developer a library of components that appear in 3 different web clients (native Mac, Windows, extension and a sidebar). Each of these views have different dimensions which I have mapped with this code:
However I do not have a way to define other properties besides height or width.
Describe the solution you'd like
I would like to be able to target different viewports in my
preview.css
(imported into.storybook/preview.tsx
) with code like this:Describe alternatives you've considered
Currently I am just applying 12px padding in preview.css to all viewpoerts and manually accounting for the viewport width on the
win
viewport by subtracting 8px from its width. It might also be possible to addpadding
to the ViewportStyles (src)[https://github.com/storybookjs/storybook/blob/next/code/addons/viewport/src/models/Viewport.ts] though a CSS approach feels cleaner.Are you able to assist to bring the feature to reality?
yes, I can
Additional context
I created a pull request that implements this fix at #25897
Beta Was this translation helpful? Give feedback.
All reactions