-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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 #8128: addon-centered clashing with addon-docs for react #8388
fix #8128: addon-centered clashing with addon-docs for react #8388
Conversation
The centered addon was clashing when used in combination with the docs addon. When on the docs page, the centered style should not be applied. Note that this commit only fixes it for React.
This pull request is being automatically deployed with ZEIT Now (learn more). 🔍 Inspect: https://zeit.co/storybook/monorepo/f77tpmmh5 |
Hmmm @CodeByAlex were you looking at this at one point? This seems like a pretty hacky solution. |
I was looking into ways to optimize addon centered but not this specific issue. I think I brought it up though I’m terms of angular but it was fixed. Whatever solution we come up with, the same should be applied to this issue for zooming #8389 |
@shilman Yeah I agree, this is not the most beautiful solution, but I was hitting this issue and saw people proposed something, just wanted to start a PR to get the ball rolling. |
@@ -5,6 +5,17 @@ import parameters from './parameters'; | |||
import styles from './styles'; | |||
|
|||
function centered(storyFn: () => ReactNode) { | |||
/* eslint-disable no-undef */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps a useViewmode
hook would be a good idea?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ndelangen I think that would be very useful, independent of this PR
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
Hi! Looks like this PR is ready, do you have any plans for releasing it? In our project we are waiting for this change This is not urgent for us, but we're looking forward to use Thank you! |
@ndelangen I'm fine with patching this into 5.3 after the release is out |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
The centered addon was clashing when used in combination with the
docs addon. When on the docs page, the centered style should not be applied.
Note that this commit only fixes it for React.
Issue:
See #8128, when on the DocsPage of the docs addon, the component is being centered in the page.
What I did
Adapted the suggestion from #8128 (comment) to check if the current view is the Docs view.
Note that this only fixes the React variant of this addon. I don't have much experience with the other frameworks, but if requested I wouldn't mind trying out fixing those as well.
Also had to disable the eslint check for no-undef for the
window
usage, tried to make it a bit better with checking ifwindow
is not undefined, but open for better suggestions :)