-
Notifications
You must be signed in to change notification settings - Fork 3
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
Feature/add button full width prop #129
Feature/add button full width prop #129
Conversation
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.
code looks good
@@ -118,6 +118,7 @@ export const baseButtonStyles = ({ | |||
buttonType, | |||
isLoading, |
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.
@mjaltamirano as far as the height thing goes, it's definitely weird. Would removing the fontSize property on the full width variant change anything? |
We went over the current Loader icon spacing fix in person, which looked good to you, but for this I actually stumbled upon what appeared to be a decent fix while troubleshooting how to get the Loader spacing improved. You can see that in the code here: https://github.com/PocketDerm/radiance-ui/pull/129/files#diff-e54f785f0d62d47619cf001bc205d9fbR171 |
@@ -35,7 +35,7 @@ const ButtonLoader = styled.div` | |||
right: 0; | |||
top: 0; | |||
margin-top: -6px; | |||
width: 38px; | |||
width: ${({ isFullWidth }) => (isFullWidth ? `25%` : `38px`)}; |
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.
25% was fairly arbitrary but was relatively close for very wide buttons (which isn't a pattern we want to use, since we're adding this for mobile), but also close enough with narrower viewports (320-400px).
This PR adds a
fullWidth
prop to Button components to make them expand to take the width of their container.There is a noticeable issue where, because the Icon does not display when the component is loading, there is an empty svg present with spatial properties that inadvertently messes up the height of the button. You can see it in the lack of perfect alignment of the full-width buttons in this screenshot:
Setting the
display: none
on the svg fixes the alignment, but we currently rely on it for positioning the text and loading animation. Similarly, if you turn offfont-size: 0.75rem
on both side-by-side button components, they are again aligned.I'm not concerned with it from a cosmetic standpoint in the storybook but it is something that could possibly cause an issue in use.