-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add component level theming #11691
Add component level theming #11691
Conversation
/snapit |
🫰✨ Thanks @aaronccasanova! Your snapshots have been published to npm. Test the snapshots by updating your yarn add @shopify/[email protected] yarn add @shopify/[email protected] yarn add @shopify/[email protected] yarn add @shopify/[email protected] |
/snapit |
🫰✨ Thanks @aaronccasanova! Your snapshots have been published to npm. Test the snapshots by updating your yarn add @shopify/[email protected] yarn add @shopify/[email protected] yarn add @shopify/[email protected] yarn add @shopify/[email protected] |
/snapit |
🫰✨ Thanks @aaronccasanova! Your snapshots have been published to npm. Test the snapshots by updating your yarn add @shopify/[email protected] yarn add @shopify/[email protected] yarn add @shopify/[email protected] yarn add @shopify/[email protected] |
/snapit |
🫰✨ Thanks @aaronccasanova! Your snapshots have been published to npm. Test the snapshots by updating your yarn add @shopify/[email protected] yarn add @shopify/[email protected] yarn add @shopify/[email protected] yarn add @shopify/[email protected] yarn add @shopify/[email protected] |
2fb8dcc
to
9b4d070
Compare
/snapit |
🫰✨ Thanks @sophschneider! Your snapshots have been published to npm. Test the snapshots by updating your yarn add @shopify/[email protected] yarn add @shopify/[email protected] yarn add @shopify/[email protected] yarn add @shopify/[email protected] |
c80a43b
to
d727992
Compare
/snapit |
🫰✨ Thanks @sophschneider! Your snapshots have been published to npm. Test the snapshots by updating your yarn add @shopify/[email protected] yarn add @shopify/[email protected] yarn add @shopify/[email protected] yarn add @shopify/[email protected] |
/snapit |
🫰✨ Thanks @sophschneider! Your snapshots have been published to npm. Test the snapshots by updating your yarn add @shopify/[email protected] yarn add @shopify/[email protected] yarn add @shopify/[email protected] yarn add @shopify/[email protected] |
2d4c209
to
5430450
Compare
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.
Awesome work! This looks great 👍
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.
Looks good! Welcome back, ThemeProvider
type ThemeNameLocal = typeof themeNamesLocal[number]; | ||
|
||
export const isThemeNameLocal = (name: string): name is ThemeNameLocal => | ||
themeNamesLocal.includes(name as any); |
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.
Weird typing going on here. Is this temporary until we can use satisfies
?
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.
This will get lightly cleaned up with the addition of satisfies
but the underlying type guard setup would remain the same. This util allows us to narrow any string before passing it to the ThemeProvider (i.e. in Portal) and used to apply runtime adherence of this design decision
4065232
to
f07e31e
Compare
Co-authored-by: aaronccasanova <[email protected]>
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @shopify/[email protected] ### Minor Changes - [#11778](#11778) [`d689bd8f4`](d689bd8) Thanks [@heyjoethomas](https://github.com/heyjoethomas)! - Added `PersonSegment` icon ## @shopify/[email protected] ### Minor Changes - [#11764](#11764) [`880f31b44`](880f31b) Thanks [@itwasmattgregg](https://github.com/itwasmattgregg)! - Added align property for FooterHelp - [#11691](#11691) [`1e613de8b`](1e613de) Thanks [@aaronccasanova](https://github.com/aaronccasanova)! - - Added `ThemeProvider` component - Removed `html` from theme classes to remove global theme constraint - Updated `useTheme` to be context aware of parent themes - Updated `Portal` component to be context aware of parent themes - Initialized a `dark-experimental` theme - [#11787](#11787) [`c3aefafe2`](c3aefaf) Thanks [@chloerice](https://github.com/chloerice)! - Added support for destructive `promotodBulkActions` to `BulkActions` ### Patch Changes - Updated dependencies \[[`1e613de8b`](1e613de), [`d689bd8f4`](d689bd8)]: - @shopify/[email protected] - @shopify/[email protected] ## @shopify/[email protected] ### Minor Changes - [#11691](#11691) [`1e613de8b`](1e613de) Thanks [@aaronccasanova](https://github.com/aaronccasanova)! - - Added `ThemeProvider` component - Removed `html` from theme classes to remove global theme constraint - Updated `useTheme` to be context aware of parent themes - Updated `Portal` component to be context aware of parent themes - Initialized a `dark-experimental` theme ## @shopify/[email protected] ### Patch Changes - Updated dependencies \[[`1e613de8b`](1e613de)]: - @shopify/[email protected] - @shopify/[email protected] ## @shopify/[email protected] ### Patch Changes - Updated dependencies \[[`1e613de8b`](1e613de)]: - @shopify/[email protected] ## [email protected] ### Patch Changes - Updated dependencies \[[`1e613de8b`](1e613de)]: - @shopify/[email protected] ## [email protected] ### Patch Changes - [#11776](#11776) [`ca8eb99ea`](ca8eb99) Thanks [@sarahill](https://github.com/sarahill)! - Updated common action patterns example - Updated dependencies \[[`880f31b44`](880f31b), [`1e613de8b`](1e613de), [`d689bd8f4`](d689bd8), [`c3aefafe2`](c3aefaf)]: - @shopify/[email protected] - @shopify/[email protected] - @shopify/[email protected] Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Part of [this issue](Shopify/polaris-internal#1513) - Removed `html` from theme classes to remove global theme constraint - Added `ThemeProvider` component - Updated `useTheme` to be context aware of parent themes - Updated `Portal` component to be context aware of parent themes - Initialized a `dark-experimental` theme Example ```tsx function App() { return ( /** Sets the default theme globally on the root HTML element (optional) */ <AppProvider theme="light"> {/* Sets the dark theme on an internal container element */} <ThemeProvider theme="dark-experimental"> {/* ... */} </ThemeProvider> </AppProvider> ) } ``` ## Tophat Note: In web we will be restricting imports of the `ThemeProvider` to only areas that Polaris approves Make sure everything looks the same on spin. The `p-theme-light` class should be added to the top html element https://admin.web.web-xubz.sophie-schneider.us.spin.dev/store/shop1 --------- Co-authored-by: Sophie Schneider <[email protected]>
Part of this issue
html
from theme classes to remove global theme constraintThemeProvider
componentuseTheme
to be context aware of parent themesPortal
component to be context aware of parent themesdark-experimental
themeExample
Tophat
Note: In web we will be restricting imports of the
ThemeProvider
to only areas that Polaris approvesMake sure everything looks the same on spin. The
p-theme-light
class should be added to the top html elementhttps://admin.web.web-xubz.sophie-schneider.us.spin.dev/store/shop1