-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[EmptyState] Add content context variant #1570
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
Our use case is within a Below is the design for the empty state provided by @pauyeung. Below is the result of tossing our content (img and text) into the modified The @pauyeung perhaps you can comment on this and how this looks? |
@Ipkhchan @chloerice - I modelled my design off of this example in the Vault update. If buttons are required, does that mean there should be double parked primary action in both the page actions and resource list (Ex. Customers, Products)? I think it could be heavy handed |
Thanks for sharing your use cases @Ipkhchan @pauyeung!
Having an |
Work on this functionality will be picked up again at the next Frideations. |
799cf7b
to
9f7c1c4
Compare
cc7ed90
to
3b65fbc
Compare
playground/images/index.ts
Outdated
@@ -0,0 +1 @@ | |||
export {default as FileUploadSpot} from './File-Upload-Spot.png'; |
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.
🔥 ?
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.
Thanks for catching, meant to 🔥 this! That was left over from when I'd saved the empty state image locally before figuring out I could reference images attached to GitHub comments 👍.
<TextContainer>{footerContent}</TextContainer> | ||
</div> | ||
) : null; | ||
const headingSize = withinContentContainer ? 'small' : 'medium'; |
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.
Maybe moving the DisplayText Size type to src/types
to use here, there and in tests would be better.
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.
To clarify, you mean I should change DisplayText.size
to use an enum instead of a union type so that I can use that there and here instead?
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.
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.
I guess you are right, it's not worth the breaking change. Didn't realize it would be. We could just share the current type but not sure there's much value.
width: $detail-width; | ||
.withinContentContainer { | ||
.Section { | ||
position: unset; |
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.
do you need unset?
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.
Yes, because the position is set to relative, when not in a content context, the position has to be unset or it still has a relative position which pushes it to the right a noticeable amount.
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 except for the image that is accidentally being committed and left a comment on the size type.
footerContent, | ||
}: EmptyStateProps) { | ||
return ( | ||
<WithinContentContext.Consumer> |
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.
As you're in a functional component you can use hooks instead of the render prop function
const withinContentContainer = useContext(WithinContentContext);
/* stuff using withinContentContainer */
instead of
return (
<WithinContentContext.Consumer>
{(withinContentContainer) => {
/* stuff using withinContentContainer */
}}
</WithinContentContext.Consumer>
);
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.
Gotcha, thanks!
f966084
to
b63293f
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.
Thanks @sarahill! I'm hesitant to add spacing around the Nesting the |
(Discussed and agreed that requested change would be breaking)
0a8e15f
to
332db66
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.
✅
332db66
to
3030987
Compare
Results💦 Potential splash zone of changes introduced to
DetailsAll files potentially affected (total: 1)❔
|
let imgSrc = | ||
'https://cdn.shopify.com/s/files/1/0757/9955/files/empty-state.svg'; | ||
|
||
describe('primaryAction', () => { |
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.
(There is no primaryAction
prop, it's just action
)
f8d7d7a
to
bda26c9
Compare
bda26c9
to
9b0ad21
Compare
WHY are these changes introduced?
This PR is one of two that will enable the improvement of transitions from skeleton loading states to empty states by adding support for use of the empty state component in a content context. For example, within a
Card
orResourceList
**.WHAT is this pull request doing?
Adds content context consumer to
EmptyState
Empty state in a card (small screen on right):
**Note: I'm adding empty state handling to
ResourceList
in a separate PR.How to 🎩
Click to view collapsed tophatting instructions
🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines
View the "Empty state in content context" example in the Chroma deployment. The latest deployment can be found by clicking the "Details" link in the
ci/chroma
check line item of the PR checks below.I recommend reviewing the code with whitespace changes removed from the diff so it's easier to see what actually changed (since I converted the component from a class to a function, most of the code in
EmptyState.tsx
shifted left one tab).or
Copy-paste this code in
playground/Playground.tsx
:How to test your use case in a content context 👩🔬
Click to view collapsed instructions for testing your use case
Add a comment to this PR with an explanation of your use case with your empty state image attached/embedded in the comment.
For example, the image attached below is here so the playground code collapsed above will work for anyone locally. This is because the
EmptyState
image
prop has the url of the attachment set as its string value.You can copy the link to your image attachment by right clicking on the image and selecting "Copy image address" from the right click menu.
PR checklist
(n/a) Tested for accessibilityREADME.md
with documentation changes