-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Layout foundations] Update AlphaStack component docs and guidance #7469
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
Merged
Merged
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
27f0e0a
Update `AlphaStack` docs
chazdean accc29f
Add changeset
chazdean e4eca6b
Refactor `Box` props
chazdean 476fc85
Refactor using `ExampleStyleGuideComponents`
chazdean 569c1c8
Add purple color custom property
chazdean 631f941
Refactor `Placeholder` component
chazdean aabd493
Move `ExampleStyleGuideComponents` within example files
chazdean 88387b0
Remove `Typescript` from examples
chazdean 34f49e4
Remove 'ExampleStyleGuideComponents' folder
chazdean b7d9ecb
Remove color custom property
chazdean 8b5b243
Update .changeset/heavy-eagles-train.md
chazdean File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'polaris.shopify.com': patch | ||
| --- | ||
|
|
||
| Update `AlphaStack` component docs and added `ExampleStyleGuideComponents` for layout primitives | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 36 additions & 10 deletions
46
polaris.shopify.com/pages/examples/alpha-stack-default.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,47 @@ | ||
| import React from 'react'; | ||
| import {AlphaStack, Badge, Text} from '@shopify/polaris'; | ||
| import {AlphaStack, Text} from '@shopify/polaris'; | ||
|
|
||
| import {withPolarisExample} from '../../src/components/PolarisExampleWrapper'; | ||
|
|
||
| function AlphaStackExample() { | ||
| return ( | ||
| <div style={{width: '100%'}}> | ||
| <AlphaStack> | ||
| <Text variant="heading4xl" as="h2"> | ||
| AlphaStack | ||
| <AlphaStack> | ||
| <Placeholder width="320px" label="Stack child" /> | ||
| <Placeholder width="320px" /> | ||
| <Placeholder width="320px" /> | ||
| </AlphaStack> | ||
| ); | ||
| } | ||
|
|
||
| const Placeholder = ({ | ||
| label = '', | ||
| height = 'auto', | ||
| width = 'auto', | ||
| childWidth = 'auto', | ||
| }) => { | ||
| return ( | ||
| <div | ||
| style={{ | ||
| background: '#7B47F1', | ||
| padding: '14px var(--p-space-2)', | ||
| height: height ?? undefined, | ||
| width: width ?? undefined, | ||
| }} | ||
| > | ||
| <div | ||
| style={{ | ||
| display: 'inline-block', | ||
| background: 'rgba(255, 255, 255, 0.3)', | ||
| color: '#FFFFFF', | ||
| width: childWidth ?? undefined, | ||
| }} | ||
| > | ||
| <Text as="h2" variant="bodyMd" fontWeight="medium"> | ||
| {label} | ||
| </Text> | ||
| <Badge>One</Badge> | ||
| <Badge>Two</Badge> | ||
| <Badge>Three</Badge> | ||
| </AlphaStack> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
| }; | ||
|
|
||
| export default withPolarisExample(AlphaStackExample); |
96 changes: 49 additions & 47 deletions
96
polaris.shopify.com/pages/examples/alpha-stack-with-align.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,66 +1,68 @@ | ||
| import React from 'react'; | ||
| import {AlphaStack, Badge, Box, Inline, Text} from '@shopify/polaris'; | ||
| import {AlphaStack, Box, Page, Inline, Text} from '@shopify/polaris'; | ||
|
|
||
| import {withPolarisExample} from '../../src/components/PolarisExampleWrapper'; | ||
|
|
||
| function AlphaStackWithAlignExample() { | ||
| return ( | ||
| <div style={{width: '100%'}}> | ||
| <Box paddingBottom="2"> | ||
| <Text variant="bodySm" as="h3"> | ||
| with align start | ||
| </Text> | ||
| </Box> | ||
| <Box paddingBottom="2"> | ||
| <Page> | ||
| <Box paddingBottom="20"> | ||
| <AlphaStack align="start"> | ||
| <Text variant="heading4xl" as="h2"> | ||
| AlphaStack | ||
| </Text> | ||
| <Inline> | ||
| <Badge>One</Badge> | ||
| <Badge>Two</Badge> | ||
| <Badge>Three</Badge> | ||
| </Inline> | ||
| <Placeholder width="320px" label="Start" childAlign="start" /> | ||
| <Placeholder width="320px" childAlign="start" /> | ||
| <Placeholder width="320px" childAlign="start" /> | ||
| </AlphaStack> | ||
| </Box> | ||
| <hr /> | ||
| <Box paddingBottom="2"> | ||
| <Text variant="bodySm" as="h3"> | ||
| with align center | ||
| </Text> | ||
| </Box> | ||
| <Box paddingBottom="2"> | ||
| <Box paddingBottom="20"> | ||
| <AlphaStack align="center"> | ||
| <Text variant="heading4xl" as="h2"> | ||
| AlphaStack | ||
| </Text> | ||
| <Inline> | ||
| <Badge>One</Badge> | ||
| <Badge>Two</Badge> | ||
| <Badge>Three</Badge> | ||
| </Inline> | ||
| <AlphaStack> | ||
| <Placeholder width="320px" label="Center" childAlign="center" /> | ||
| <Placeholder width="320px" childAlign="center" /> | ||
| <Placeholder width="320px" childAlign="center" /> | ||
| </AlphaStack> | ||
| </AlphaStack> | ||
| </Box> | ||
| <hr /> | ||
| <Box paddingBottom="2"> | ||
| <Text variant="bodySm" as="h3"> | ||
| with align end | ||
| </Text> | ||
| </Box> | ||
| <Box paddingBottom="2"> | ||
| <Box> | ||
| <AlphaStack align="end"> | ||
| <Text variant="heading4xl" as="h2"> | ||
| AlphaStack | ||
| </Text> | ||
| <Inline> | ||
| <Badge>One</Badge> | ||
| <Badge>Two</Badge> | ||
| <Badge>Three</Badge> | ||
| </Inline> | ||
| <Placeholder width="320px" label="End" childAlign="end" /> | ||
| <Placeholder width="320px" childAlign="center" /> | ||
| <Placeholder width="320px" childAlign="center" /> | ||
| </AlphaStack> | ||
| </Box> | ||
| </div> | ||
| </Page> | ||
| ); | ||
| } | ||
|
|
||
| const Placeholder = ({ | ||
| label = '', | ||
| height = 'auto', | ||
| width = 'auto', | ||
| childAlign, | ||
| }) => { | ||
| return ( | ||
| <div | ||
| style={{ | ||
| background: 'var(--surface-example-block)', | ||
| padding: '14px var(--p-space-2)', | ||
| height: height ?? undefined, | ||
| width: width ?? undefined, | ||
| }} | ||
| > | ||
| <Inline align={childAlign}> | ||
| <div | ||
| style={{ | ||
| display: 'inline-block', | ||
| background: 'rgba(255, 255, 255, 0.3)', | ||
| color: '#FFFFFF', | ||
| }} | ||
| > | ||
| <Text as="h2" variant="bodyMd" fontWeight="medium"> | ||
| {label} | ||
| </Text> | ||
| </div> | ||
| </Inline> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default withPolarisExample(AlphaStackWithAlignExample); |
46 changes: 36 additions & 10 deletions
46
polaris.shopify.com/pages/examples/alpha-stack-with-full-width-children.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,47 @@ | ||
| import React from 'react'; | ||
| import {AlphaStack, Badge, Text} from '@shopify/polaris'; | ||
| import {AlphaStack, Text} from '@shopify/polaris'; | ||
|
|
||
| import {withPolarisExample} from '../../src/components/PolarisExampleWrapper'; | ||
|
|
||
| function AlphaStackWithFullWidthChildrenExample() { | ||
| return ( | ||
| <div style={{width: '100%'}}> | ||
| <AlphaStack fullWidth> | ||
| <Text variant="heading4xl" as="h2"> | ||
| AlphaStack | ||
| <AlphaStack fullWidth> | ||
| <Placeholder label="Stack child" childWidth="100%" /> | ||
| <Placeholder /> | ||
| <Placeholder /> | ||
| </AlphaStack> | ||
| ); | ||
| } | ||
|
|
||
| const Placeholder = ({ | ||
| label = '', | ||
| height = 'auto', | ||
| width = '100%', | ||
| childWidth = 'auto', | ||
| }) => { | ||
| return ( | ||
| <div | ||
| style={{ | ||
| background: 'var(--surface-example-block)', | ||
| padding: '14px var(--p-space-2)', | ||
| height: height ?? undefined, | ||
| width: width ?? undefined, | ||
| }} | ||
| > | ||
| <div | ||
| style={{ | ||
| display: 'inline-block', | ||
| background: 'rgba(255, 255, 255, 0.3)', | ||
| color: '#FFFFFF', | ||
| width: childWidth ?? undefined, | ||
| }} | ||
| > | ||
| <Text as="h2" variant="bodyMd" fontWeight="medium"> | ||
| {label} | ||
| </Text> | ||
| <Badge>One</Badge> | ||
| <Badge>Two</Badge> | ||
| <Badge>Three</Badge> | ||
| </AlphaStack> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
| }; | ||
|
|
||
| export default withPolarisExample(AlphaStackWithFullWidthChildrenExample); |
108 changes: 53 additions & 55 deletions
108
polaris.shopify.com/pages/examples/alpha-stack-with-spacing.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,66 +1,64 @@ | ||
| import React from 'react'; | ||
| import {AlphaStack, Badge, Box, Inline, Text} from '@shopify/polaris'; | ||
| import {AlphaStack, Text} from '@shopify/polaris'; | ||
|
|
||
| import {withPolarisExample} from '../../src/components/PolarisExampleWrapper'; | ||
|
|
||
| function AlphaStackWithSpacingExample() { | ||
| return ( | ||
| <div style={{width: '100%'}}> | ||
| <Box paddingBottom="2"> | ||
| <Text variant="bodySm" as="h3"> | ||
| with spacing 0 | ||
| </Text> | ||
| </Box> | ||
| <Box paddingBottom="2"> | ||
| <AlphaStack spacing="0"> | ||
| <Text variant="heading4xl" as="h2"> | ||
| AlphaStack | ||
| </Text> | ||
| <Inline> | ||
| <Badge>One</Badge> | ||
| <Badge>Two</Badge> | ||
| <Badge>Three</Badge> | ||
| </Inline> | ||
| </AlphaStack> | ||
| </Box> | ||
| <hr /> | ||
| <Box paddingBottom="2"> | ||
| <Text variant="bodySm" as="h3"> | ||
| with spacing 4 | ||
| </Text> | ||
| </Box> | ||
| <Box paddingBottom="2"> | ||
| <AlphaStack spacing="4"> | ||
| <Text variant="heading4xl" as="h2"> | ||
| AlphaStack | ||
| </Text> | ||
| <Inline> | ||
| <Badge>One</Badge> | ||
| <Badge>Two</Badge> | ||
| <Badge>Three</Badge> | ||
| </Inline> | ||
| </AlphaStack> | ||
| </Box> | ||
| <hr /> | ||
| <Box paddingBottom="2"> | ||
| <Text variant="bodySm" as="h3"> | ||
| with spacing 10 | ||
| <SpacingBackground width="320px"> | ||
| <AlphaStack spacing="5"> | ||
| <Placeholder width="320px" label="Stack child" /> | ||
| <Placeholder width="320px" /> | ||
| <Placeholder width="320px" /> | ||
| </AlphaStack> | ||
| </SpacingBackground> | ||
| ); | ||
| } | ||
|
|
||
| const SpacingBackground = ({children, width}) => { | ||
| return ( | ||
| <div | ||
| style={{ | ||
| background: | ||
| 'repeating-linear-gradient(-45deg, #7B47F1, #7B47F1 1px, #E8D1FA 1px, #E8D1FA 7px)', | ||
| width: width ?? '100%', | ||
| height: 'auto', | ||
| }} | ||
| > | ||
| {children} | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| const Placeholder = ({ | ||
| label = '', | ||
| height = 'auto', | ||
| width = 'auto', | ||
| childWidth = 'auto', | ||
| }) => { | ||
| return ( | ||
| <div | ||
| style={{ | ||
| background: 'var(--surface-example-block)', | ||
| padding: '14px var(--p-space-2)', | ||
| height: height ?? undefined, | ||
| width: width ?? undefined, | ||
| }} | ||
| > | ||
| <div | ||
| style={{ | ||
| display: 'inline-block', | ||
| background: 'rgba(255, 255, 255, 0.3)', | ||
| color: '#FFFFFF', | ||
| width: childWidth ?? undefined, | ||
| }} | ||
| > | ||
| <Text as="h2" variant="bodyMd" fontWeight="medium"> | ||
| {label} | ||
| </Text> | ||
| </Box> | ||
| <Box paddingBottom="2"> | ||
| <AlphaStack spacing="10"> | ||
| <Text variant="heading4xl" as="h2"> | ||
| AlphaStack | ||
| </Text> | ||
| <Inline> | ||
| <Badge>One</Badge> | ||
| <Badge>Two</Badge> | ||
| <Badge>Three</Badge> | ||
| </Inline> | ||
| </AlphaStack> | ||
| </Box> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
| }; | ||
|
|
||
| export default withPolarisExample(AlphaStackWithSpacingExample); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.