-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Rebuild EmptyState component with layout primitives
#7809
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
Changes from all commits
7b0847f
e20127b
513db9c
f6f11ac
ad0d867
1c32286
5cf6e15
421082a
6e6d97f
9498d87
b8620d8
a30abce
8a02260
f771e3e
49f5763
08a5d05
3d8fc97
61b4223
d2ff651
fc21b67
4afece0
ea0150a
4236de6
c1c982b
20dfd92
527f8db
40b8ea5
f1f1287
97a9798
2c1ae18
2660d00
efbe25d
5530643
0a486f3
cde834b
d3d623d
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 |
|---|---|---|
| @@ -1,156 +1,8 @@ | ||
| @import '../../styles/common'; | ||
|
|
||
| $within-page-detail-width: 336px; | ||
| $detail-width: 400px; | ||
|
|
||
| $stacking-order: ( | ||
| illustration: 0, | ||
| details: 10, | ||
| ); | ||
|
|
||
| $left-offset: 35%; | ||
| $right-offset: 10%; | ||
|
|
||
| // Multiply by 2 to expand the image size to align with design requirements | ||
| $illustration-left-margin: $left-offset * -2; | ||
|
|
||
| // Shift the illustration to the left to overlap with Details | ||
| $illustration-width: calc(100% + #{$left-offset} * 2); | ||
|
|
||
| // Respect the right offset on mobile so the illustration shows the correct | ||
| // crop zone | ||
| $illustration-width-cropped: calc( | ||
| #{$illustration-width} + #{$right-offset} * 2 | ||
| ); | ||
|
|
||
| $centered-illustration-width: 226px; | ||
|
|
||
| .EmptyState { | ||
| // stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
| display: flex; | ||
| flex-direction: column; | ||
| // stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
| align-items: center; | ||
| // stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
| width: 100%; | ||
| margin: 0 auto; | ||
| padding: var(--p-space-5) 0; | ||
| padding-top: var(--p-space-5); | ||
| padding-bottom: calc(3 * var(--p-space-5)); | ||
| max-width: $page-max-width; | ||
| } | ||
|
|
||
| .Section { | ||
| // stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
| display: flex; | ||
| flex-direction: column-reverse; | ||
| // stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
| flex: 1 1 auto; | ||
| // stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
| width: 100%; | ||
| // stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
| align-items: center; | ||
| // stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
| justify-content: center; | ||
|
|
||
| @media #{$p-breakpoints-md-up} { | ||
| // stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
| left: var(--p-space-5); | ||
| } | ||
| } | ||
|
|
||
| .Details { | ||
| // stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
| display: flex; | ||
| text-align: center; | ||
| flex-direction: column; | ||
| // stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
| align-items: center; | ||
|
|
||
| @media #{$p-breakpoints-sm-up} { | ||
| max-width: $detail-width; | ||
| } | ||
| } | ||
|
|
||
| .Image { | ||
| margin: 0; | ||
| // stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
| width: initial; | ||
| } | ||
|
|
||
| .ImageContainer, | ||
| .DetailsContainer { | ||
| // stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
| flex: 1 1 auto; | ||
| padding: 0; | ||
| margin: 0; | ||
|
|
||
| @media #{$p-breakpoints-md-up} { | ||
| // stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
| flex-basis: 50%; | ||
| } | ||
| } | ||
|
|
||
| .withinContentContainer { | ||
| margin: 0 auto; | ||
| padding-top: var(--p-space-5); | ||
| padding-bottom: calc(3 * var(--p-space-5)); | ||
|
|
||
| .Section { | ||
| // stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
| position: unset; | ||
| flex-direction: column-reverse; | ||
| // stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
| align-items: center; | ||
| // stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
| justify-content: center; | ||
| } | ||
|
|
||
| .Details { | ||
| // stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
| display: flex; | ||
| text-align: center; | ||
| flex-direction: column; | ||
| // stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
| align-items: center; | ||
|
|
||
| @media #{$p-breakpoints-sm-up} { | ||
| max-width: $detail-width; | ||
| } | ||
| } | ||
|
|
||
| .Image { | ||
| margin: 0; | ||
| // stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
| width: initial; | ||
| } | ||
|
|
||
| .Content { | ||
| padding-bottom: var(--p-space-2); | ||
| } | ||
| } | ||
|
|
||
| .imageContained { | ||
|
Contributor
Author
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. had to keep this class because we don't do responsive props in |
||
| .Image { | ||
| @media #{$p-breakpoints-md-up} { | ||
| // stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
| position: initial; | ||
| // stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
| width: 100%; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| .fullWidth { | ||
| .Details { | ||
| max-width: 100%; | ||
| @media #{$p-breakpoints-md-up} { | ||
| position: initial; | ||
| width: 100%; | ||
| } | ||
| } | ||
|
|
||
| .Content { | ||
| padding-bottom: var(--p-space-2); | ||
| } | ||
|
|
||
| .Actions { | ||
| margin-top: var(--p-space-4); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,3 +70,19 @@ export function WithFullWidthLayout() { | |
| </Card> | ||
| ); | ||
| } | ||
|
|
||
| export function WithoutContentContainer() { | ||
|
Contributor
Author
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. added this story for any cases when an empty state component is not wrapped in a content container |
||
| return ( | ||
| <EmptyState | ||
| heading="Manage your inventory transfers" | ||
| action={{content: 'Add transfer'}} | ||
| secondaryAction={{ | ||
| content: 'Learn more', | ||
| url: 'https://help.shopify.com', | ||
| }} | ||
| image="https://cdn.shopify.com/s/files/1/0262/4071/2726/files/emptystate-files.png" | ||
| > | ||
| <p>Track and receive your incoming inventory from suppliers.</p> | ||
| </EmptyState> | ||
| ); | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.