-
Notifications
You must be signed in to change notification settings - Fork 114
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
Feat/stack customization #1722
Feat/stack customization #1722
Conversation
zahnster
commented
Aug 2, 2021
- Enable stack and stack children to respect element customizations set on the customization provider.
- Stack and stack children now enable setting an element name on the underlying HTML element, and checks the emotion theme object to determine whether it should merge in custom styles to the ones set by the component author.
- Stories and tests added to support this change
🦋 Changeset detectedLatest commit: f3b3e7c The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✔️ Deploy Preview for paste-docs ready! 🔨 Explore the source changes: f3b3e7c 🔍 Inspect the deploy log: https://app.netlify.com/sites/paste-docs/deploys/6109642b257771000772dc35 😎 Browse the preview: https://deploy-preview-1722--paste-docs.netlify.app |
Size Change: +80 B (0%) Total Size: 617 kB
ℹ️ View Unchanged
|
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit f3b3e7c:
|
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 great! I'm curious why you were able to add element = 'STACK'
on line 80 without having to also add element
to the StackProps
. Is it because StackProps
extends BoxElementProps
which element
was already added to?
Stack.propTypes = { | ||
orientation: ResponsiveProp(PropTypes.oneOf(['horizontal', 'vertical'])).isRequired, | ||
spacing: isSpaceTokenProp, | ||
element: PropTypes.string, |
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.
Question here, looks like element
wasn't added to Media Object's propTypes
in that PR. Should it have been, or is this unnecessary?
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, it should have
{validChildren.map((child, index) => { | ||
return ( | ||
<Box | ||
element={`${element}_CHILD`} |
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'm not sure I understand why we're giving the children an element
prop. Wouldn't all of the children have the same name as the parent element
and therefore all be styled the same?
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.
It creates an element name for the child based on the parent element name, but not exactly the same.
So yes, child elements have the same name, but it is different to the parent. It's potentially easier to see here in the tests https://github.com/twilio-labs/paste/pull/1722/files#diff-160e3be247ff4ca5d35a10f9e526e4cf0aa098b6b43b134a322e93e3c2ab75a4R159
@nkrantz 100% correct. Well spotted |
cc3188c
to
f3b3e7c
Compare