-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Update AlphaStack
#7429
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
Update AlphaStack
#7429
Changes from all commits
51af10b
bee84fd
b7d117d
aefe235
4ce25f7
dd0dabe
1d22713
5a43545
ed9201b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@shopify/polaris': minor | ||
| --- | ||
|
|
||
| Update `AlphaStack` to be polymorphic, add list reset styles and allow spacing to change based on breakpoint |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,13 @@ | ||
| import type {BreakpointsAlias} from '@shopify/polaris-tokens'; | ||
|
|
||
| type Falsy = boolean | undefined | null | 0; | ||
|
|
||
| export type ResponsiveProp<T> = | ||
| | T | ||
| | { | ||
| [Breakpoint in BreakpointsAlias]?: T; | ||
| }; | ||
|
Comment on lines
+5
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wondering if this should be exported from tokens instead of this css utils file? Thoughts on moving it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @aaronccasanova would be great to get your thoughts on this |
||
|
|
||
| export function classNames(...classes: (string | Falsy)[]) { | ||
| return classes.filter(Boolean).join(' '); | ||
| } | ||
|
|
@@ -17,3 +25,27 @@ export function sanitizeCustomProperties( | |
|
|
||
| return nonNullValues.length ? Object.fromEntries(nonNullValues) : undefined; | ||
| } | ||
|
|
||
| export function getResponsiveProps( | ||
| componentName: string, | ||
| componentProp: string, | ||
| tokenSubgroup: string, | ||
| responsiveProp: | ||
| | string | ||
| | { | ||
| [Breakpoint in BreakpointsAlias]?: string; | ||
| }, | ||
| ) { | ||
| if (typeof responsiveProp === 'string') { | ||
| return { | ||
| [`--pc-${componentName}-${componentProp}-xs`]: `var(--p-${tokenSubgroup}-${responsiveProp})`, | ||
| }; | ||
| } | ||
|
|
||
| return Object.fromEntries( | ||
| Object.entries(responsiveProp).map(([breakpointAlias, aliasOrScale]) => [ | ||
| `--pc-${componentName}-${componentProp}-${breakpointAlias}`, | ||
| `var(--p-${tokenSubgroup}-${aliasOrScale})`, | ||
| ]), | ||
| ); | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.