-
Notifications
You must be signed in to change notification settings - Fork 5k
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
15087: Add Button Base #15998
15087: Add Button Base #15998
Conversation
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. |
it('should render with different button states', () => { | ||
const { getByTestId } = render( | ||
<> | ||
{/* <ButtonBase loading data-testid="loading" /> */} |
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.
Commented this one out because the loading icon is using Icon
component, but in testing doesn't have access to the ICON_NAMES
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.
not sure that the MOCK_ICON_NAMES will actually solve this either since it is referring to the loading icon which is nested inside the component.
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.
One work around is to add loadingIconProps
to the button component and pass in the name for this test just to make sure it's working for tests.
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.
Does this still need addressing?
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 we think loadingIconProps
is worth adding to the button just for the test?
Is there something we can do to the Icon
component so we can avoid doing workarounds on all of our future components that use the icon?
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.
Yup something that will need to be fixed for Icons. I've created an issue #16046 I think we can move forward with this PR and resolve this test once this issue has been resolved
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.
Looking really good 💯 Left some tiny suggestions
it('should render with different button states', () => { | ||
const { getByTestId } = render( | ||
<> | ||
{/* <ButtonBase loading data-testid="loading" /> */} |
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.
ui/components/component-library/button-base/button-base.test.js
Outdated
Show resolved
Hide resolved
&--inherit { | ||
font-family: inherit; | ||
font-weight: inherit; | ||
font-size: inherit; | ||
line-height: inherit; | ||
letter-spacing: inherit; | ||
} | ||
|
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.
Should any documentation in the Text component reflect this update?
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.
Yea probably should. I will add a quick something
Builds ready [4d13701]
Page Load Metrics (2223 ± 55 ms)
highlights:storybook
|
Builds ready [87cd0ed]
Page Load Metrics (2443 ± 91 ms)
highlights:storybook
|
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.
Looking really good! I was playing around with making the default display: inline-flex; so when the root element is changed to an a tag it doesn't break but no biggy. Cause I know it will generally be used with ButtonLink type and then we also would need have some irrelevant flex options so up to you 🤷
This fixes it but you get those irrelevant flex options for all buttons and I'm not sure if it's worth conditionally adding them
ui/components/component-library/button-base/button-base.test.js
Outdated
Show resolved
Hide resolved
add button constants button base updates base button docs update add iconprops base button update block doc on button
526f91c
to
c903ed4
Compare
Builds ready [54f05f6]
Page Load Metrics (2257 ± 123 ms)
highlights:storybook
|
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.
LGTM! Nice work 🔥🔥🔥
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.
Just a nit and a question. Nice work!
'mm-button', | ||
`mm-button--size-${size}`, | ||
{ | ||
[`mm-button--loading`]: Boolean(loading), |
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 don't believe we need the wrapping []
around the classname keys here and the next few lines.
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.
Correct, no need for the []
👍
it('should render with different button states', () => { | ||
const { getByTestId } = render( | ||
<> | ||
{/* <ButtonBase loading data-testid="loading" /> */} |
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.
Does this still need addressing?
border-radius: 999px; | ||
cursor: pointer; | ||
color: var(--color-text-default); | ||
background-color: #dcdcdc; |
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.
should we be using a variable here as well?
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.
Probably, all ask the designer if we want to use a different color. #dcdcdc color is used in the design, but we currently don't have that as a defined token(variable) color
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.
Designer said it's fine to leave as is, but can also use Brand/Grey100 (#D6D9DC). I will update using that variable.
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.
Nice catch @segun! We shouldn't have any static hex values in our code base if we can avoid it :)
Builds ready [ce4d401]
Page Load Metrics (2468 ± 107 ms)
highlights:storybook
|
Co-authored-by: George Marshall <[email protected]>
Builds ready [25bf9c4]
Page Load Metrics (2174 ± 91 ms)
highlights:storybook
|
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.
LGTM :)
Builds ready [1021345]
Page Load Metrics (2377 ± 64 ms)
highlights:storybook
|
Explanation
Adding new Design System Button:
The ButtonBase can be used when needing to build a customized button, which can then be proposed to the design system.
[Figma].(https://www.figma.com/file/HKpPKij9V3TpsyMV1TpV7C/DS-Components?node-id=11%3A15)
More Information
Fixes #15087
Screenshots/Screencaps
Manual Testing Steps
yarn test:unit:jest .ui/components/component-library/button-base/button-base.test.js
Pre-Merge Checklist
+ If there are functional changes: