Skip to content
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

Adding border radius full to Box component #16118

Merged
merged 4 commits into from
Oct 7, 2022

Conversation

georgewrmarshall
Copy link
Contributor

@georgewrmarshall georgewrmarshall commented Oct 7, 2022

Explanation

Currently, there is no border radius prop option for a "full" pill like border radius.

This is a problem because currently engineers have to add extra css to achieve this and there are many instances where this would be useful

In order to solve this problem, this pull request adds a full(9999px) border radius option. It also separates the options from the main SIZE const in the design-system constants. It also updates tests, docs and stories.

More Information

Screenshots/Screencaps

After

Screen Shot 2022-10-06 at 6 11 50 PM

Screen Shot 2022-10-06 at 6 12 43 PM

Manual Testing Steps

  • Go to the latest build of storybook on this PR
  • Search Box component in search bar
  • Check storybook controls for borderRadius work
  • Check documentation for borderRadius in the Docs tab

Pre-Merge Checklist

  • PR template is filled out
  • IF this PR fixes a bug, a test that would have caught the bug has been added
  • PR is linked to the appropriate GitHub issue
  • PR has been added to the appropriate release Milestone

+ If there are functional changes:

  • Manual testing complete & passed
  • "Extension QA Board" label has been applied

I will update all the current uses of the SIZE const for borderRadius and deprecate SIZES.NONE in another PR

Screen Shot 2022-10-06 at 4 58 35 PM
Screen Shot 2022-10-06 at 5 00 42 PM

@georgewrmarshall georgewrmarshall added the area-UI Relating to the user interface. label Oct 7, 2022
@georgewrmarshall georgewrmarshall self-assigned this Oct 7, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2022

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@georgewrmarshall georgewrmarshall added the team-design-system All issues relating to design system in Extension label Oct 7, 2022
@georgewrmarshall georgewrmarshall changed the title Adding border radius full and updating border radius sizes for box Adding border radius full to Box component Oct 7, 2022
@garrettbear
Copy link
Contributor

Probably will want to decide if the name will be pill or full. Currently have this open PR for design-token on border radii calling it pill: https://github.com/MetaMask/design-tokens/pull/241/files#diff-0371f9c646f2c222a46785df8cdb08677de46208ba48f57aa4a7f2f28eaf9cc5R823

| borderWidth | 0, 1, 2, 4, 6, 8, 9, 10, 12 or array of numbers [1, 2] for responsive props | - |
| borderRadius | BORDER_RADIUS values or array of BORDER_RADIUS values for responsive props from [../ui/helpers/constants/design-system.js](https://github.com/MetaMask/metamask-extension/blob/develop/ui/helpers/constants/design-system.js) | - |
| borderStyle | BORDER_STYLE values or array of BORDER_STYLE values for responsive props from [../ui/helpers/constants/design-system.js](https://github.com/MetaMask/metamask-extension/blob/develop/ui/helpers/constants/design-system.js) | - |
| as | The polymorphic `as` prop allows you to change the root HTML element of the Box component. Defaults to 'div' | 'div' |

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Realized that links to blobbing although probably quite helpful. Become rapidly out of date as we edit or update the design-system.js file so updating to link to the file in general

Screen Shot 2022-10-06 at 6 12 17 PM

@@ -9,8 +9,8 @@ import {
ALIGN_ITEMS,
JUSTIFY_CONTENT,
TEXT_ALIGN,
SIZES,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm just as amazed as you are the we only use SIZES for bordeRadius in the Box component 😮

Comment on lines -137 to +157
border-radius: 0.125rem;
border-radius: 2px;
}

&--rounded-sm {
border-radius: 0.25rem;
border-radius: 4px;
}

&--rounded-md {
border-radius: 0.375rem;
border-radius: 6px;
}

&--rounded-lg {
border-radius: 0.5rem;
border-radius: 8px;
}

&--rounded-xl {
border-radius: 0.75rem;
border-radius: 12px;
}

&--rounded-pill {
border-radius: 9999px;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updating to pixels here for less cognitive load when making the calculation to rems. There isn't any benefit in using rems outside of font sizes.

@georgewrmarshall georgewrmarshall marked this pull request as ready for review October 7, 2022 01:24
@georgewrmarshall georgewrmarshall requested a review from a team as a code owner October 7, 2022 01:24
@georgewrmarshall georgewrmarshall requested review from darkwing, garrettbear and brad-decker and removed request for darkwing October 7, 2022 01:24
@georgewrmarshall georgewrmarshall mentioned this pull request Oct 7, 2022
6 tasks
@metamaskbot
Copy link
Collaborator

Builds ready [2b8e6cd]
Page Load Metrics (2321 ± 67 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint912325229481231
domContentLoaded20592626229812761
load20592626232113967
domInteractive20592626229812761

highlights:

storybook

Copy link
Contributor

@brad-decker brad-decker left a comment

Choose a reason for hiding this comment

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

Awesome.

@georgewrmarshall georgewrmarshall merged commit 90badb2 into develop Oct 7, 2022
@georgewrmarshall georgewrmarshall deleted the feat/16116/box-border-radius-update branch October 7, 2022 15:38
@github-actions github-actions bot locked and limited conversation to collaborators Oct 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-UI Relating to the user interface. team-design-system All issues relating to design system in Extension
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add 9999px border radius option to Box component
5 participants