Skip to content

BorderBox updates #329

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 12 commits into from
Oct 25, 2018
Merged

BorderBox updates #329

merged 12 commits into from
Oct 25, 2018

Conversation

emplums
Copy link

@emplums emplums commented Oct 25, 2018

This PR removes borders, borderColor, borderRadius, boxShadow props from the LAYOUT group of props, and places them in the BorderBox component instead.

Merge checklist

  • Changed base branch to release branch
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

@vercel
Copy link

vercel bot commented Oct 25, 2018

This pull request is automatically deployed with Now.
To access deployments, click Details below or on the icon next to each push.

src/BorderBox.js Outdated
@@ -8,7 +9,7 @@ const BorderBox = withSystemProps(
borderColor: 'gray.2',
borderRadius: 1
},
LAYOUT
[...LAYOUT, boxShadow]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since borderColor, borderRadius, and border are already set up with defualts in lines 5-10 we don't need to re-apply them here, only boxShadow needed to be added

Copy link
Contributor

@colebemis colebemis Oct 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LAYOUT is just a list of strings so it might make sense to add the boxShadow system prop using a string instead of a function here. Making boxShadow a string would also fix the issue with boxShadow being included in HTML markup, which I believe is happening because BorderBox.propTypes doesn't include the boxShadow prop so it isn't being added to the blacklist.

Suggested change
[...LAYOUT, boxShadow]
[...LAYOUT, 'boxShadow']

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch @colebemis!! 🙌

<Flex {...rest} size={size} alignItems="center" justifyContent="center">
<Octicon icon={icon} size={size} />
</Flex>
<BorderBox bg={bg} overflow='hidden' border='none' size={size} borderRadius='50%'>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels kind of lame but 🤷‍♀️

@@ -117,6 +117,7 @@ exports[`Dropdown matches the snapshots 1`] = `
</svg>
</summary>
<div
boxShadow="small"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't figure out why this is being left behind on the HTML markup 🤔 any thoughts @shawnbot ?

Copy link
Contributor

@colebemis colebemis Oct 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this change will remove boxShadow=... from the markup

@emplums emplums requested a review from shawnbot October 25, 2018 00:47
@@ -8,7 +8,7 @@ const BorderBox = withSystemProps(
borderColor: 'gray.2',
borderRadius: 1
},
LAYOUT
[...LAYOUT, 'boxShadow']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing to note here is that system-components infers styled-system props from the default props object ({is: 'div', ...}), which is why we don't have to explicitly list borders, borderColor, and borderRadius here. We might want to do that anyway, since (IIRC) that behavior wasn't carried over to @rebass/components, which we plan to (eventually) upgrade to in #240.

Copy link
Contributor

@shawnbot shawnbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, thanks for this! I think it makes a lot of sense not to overload Box with all those props. I left one note about explicitly listing the BorderBox system-props, but that's linked from #240 now so we could address it when we get around to that work if you'd rather get this out as-is.

@emplums emplums changed the base branch from master to q4-haunted-kittens October 25, 2018 21:18
@emplums emplums merged commit 566a369 into q4-haunted-kittens Oct 25, 2018
@emplums emplums deleted the border-box branch October 25, 2018 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants