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

Feature/add button full width prop #129

Merged
merged 15 commits into from
Jul 8, 2019

Conversation

michaeljaltamirano
Copy link
Contributor

@michaeljaltamirano michaeljaltamirano commented Jun 28, 2019

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:

Screen Shot 2019-06-28 at 4 31 38 PM

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 off font-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.

@snags88 snags88 temporarily deployed to curology-radiance-pr-129 June 28, 2019 23:27 Inactive
@michaeljaltamirano michaeljaltamirano temporarily deployed to curology-radiance-pr-129 June 28, 2019 23:28 Inactive
@michaeljaltamirano michaeljaltamirano temporarily deployed to curology-radiance-pr-129 June 28, 2019 23:38 Inactive
@michaeljaltamirano michaeljaltamirano temporarily deployed to curology-radiance-pr-129 June 28, 2019 23:39 Inactive
Copy link
Contributor

@daigof daigof left a 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,
Copy link
Contributor

Choose a reason for hiding this comment

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

image

Is it possible to move the loading spinner into the same area as the text here? It currently pushes way out to the side.

@benkolde
Copy link
Contributor

benkolde commented Jul 1, 2019

@mjaltamirano as far as the height thing goes, it's definitely weird. Would removing the fontSize property on the full width variant change anything?

@michaeljaltamirano michaeljaltamirano temporarily deployed to curology-radiance-pr-129 July 1, 2019 19:53 Inactive
@michaeljaltamirano michaeljaltamirano temporarily deployed to curology-radiance-pr-129 July 2, 2019 23:40 Inactive
@michaeljaltamirano michaeljaltamirano temporarily deployed to curology-radiance-pr-129 July 3, 2019 00:06 Inactive
@michaeljaltamirano
Copy link
Contributor Author

@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`)};
Copy link
Contributor Author

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).

@michaeljaltamirano michaeljaltamirano merged commit f6bb1e2 into master Jul 8, 2019
@michaeljaltamirano michaeljaltamirano deleted the feature/add-button-full-width-prop branch July 8, 2019 21:53
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.

4 participants