-
Notifications
You must be signed in to change notification settings - Fork 97
refactor: remove theme defaultProp
#1905
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
Conversation
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.
Unfortunately, I don't think this is the desired change. Garden element components need to continue to render even when not wrapped by a ThemeProvider. In other words, this change needs to occur in a non-breaking fashion. Most likely this is via argument defaults on element components which are in-turn passed down to view components. But some exploration/discussion may be necessary. Furthermore, the changes must be validated via npx garden cmd-docgen --pretty <path> to ensure that every affected component retains the expected prop documentation.
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.
+1 JZ's comment. I was under the impression we wanted to keep theme as a default prop but explore how that can be achieved with styled components first, as the changeset is pretty big (as this PR is evident).
Also I remember we talked about keeping the initial change isolated on ThemeProvider as its the biggest culprit of console warnings in development. 😅
|
Here's a table comparing popular React component libraries written with
While |
|
@ze-flo I think this is pretty compelling evidence that you're on the right path with this PR. Can we get the |
I updated the migration docs and created a ticket to add the corresponding ADR in a follow-up PR. |
Co-authored-by: Jonathan Zempel <[email protected]>
Description
This initiates the process of removing
defaultPropsto avoid deprecation warnings, focusing first ontheme. Since v9 depends entirely onThemeProviderand itsthemefor dark mode, rendering a component without wrapping it inThemeProvidershould result in failure.Detail
eslint-plugin-garden-localThemeProvider: sets the theme prop's default toDEFAULT_THEMEChecklist
🌐 demo is up-to-date (npm start)⬅️ renders as expected with reversed (RTL) direction⚫ renders as expected in dark mode🤘 renders as expected with Bedrock CSS (?bedrock)💂♂️ includes new unit tests. Maintain existing coverage (always >= 96%)♿ tested for WCAG 2.1 AA accessibility compliance📝 tested in Chrome, Firefox, Safari, and Edge