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

New button styles #16

Merged
merged 6 commits into from
May 23, 2019
Merged

New button styles #16

merged 6 commits into from
May 23, 2019

Conversation

adriana-alter
Copy link
Contributor

No description provided.

@@ -16,7 +16,7 @@ export default class Button extends React.Component<ButtonProps, {}> {

render(): JSX.Element {
let content = this.props.content || "Submit";
let className = `btn ${this.props.className || "btn-default"}`;
let className = `btn${this.props.className ? ` ${this.props.className}` : ""}`;
Copy link
Member

Choose a reason for hiding this comment

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

What happens to btn-default now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not needed; the default styling comes from btn.

background: $blue;
margin: .5em;
border-radius: .25em;
font-size: 16px;
&.btn-danger {
Copy link
Member

Choose a reason for hiding this comment

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

I know this was here before, but why isn't this danger just like how success is success and not btn-success?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because we were originally pulling the styling from Bootstrap, where the class name is btn-danger. (But yes, that should be updated now; good catch!)

&:not(.tab-button) {
border-radius: .25em;
margin: .5em;
&.left-align {
Copy link
Member

Choose a reason for hiding this comment

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

Why not just make the margin 0 for all cases and let the app decide if the button needs margin? I think that's better than having these classes, one for each of the margin style rules.

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 would strongly prefer to keep it like this; aside from the fact that at this point it is going to be SUCH A HASSLE to go through everything and individually decide whether every single button needs margins, I think it makes a LOT more sense to have a reasonable default margin that the app can override if necessary. I can't imagine that anyone actually wants a button with a 0 margin; making 0 the default just entails creating more work for whoever is using this component, which is at odds with the purpose of having a reusable button in the first place.

We could go back to having the .5em margin for everything, rather than having these classes. But I do think that having the separate classes makes things easier for whoever is using this. I like the idea that the component already has a lot of options out of the box, so that the expectation is that you can just drop it in as-is; writing your own style rules for it seems like it should be the exception, if you want something really customized. How much is this bothering you?

Copy link
Member

Choose a reason for hiding this comment

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

It's not that it's bothering me, it's more that margin 0 is the default for other libraries. If you check normalize, carbon, uswds, and bootstrap, the default is margin 0 for their buttons and if any app needs to add or override it, they can do so. But the margin is not set to something and you add classes to make it go back down to 0. It's a pattern that is used and I suggest trying to follow it, although I do know it'll be work to update the other apps with this change. Think about it and any other arguments are welcomed to see what should be done.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, but I assume Bootstrap and Carbon are doing that because they're thinking in terms of a grid-based system (i.e. they figure that something other than the margin is already handling the spacing), and Normalize started out just as an alternative to CSS resets--not really the same category of thing as this. Foundation, Picnic, and Sierra--which are more in line with what we're trying to do--don't follow the margin 0 pattern.

Anyway. I propose we leave this as-is for now, and revisit the conversation (ideally with input from the UX team) at the point at which other developers start trying to use these components. But if we do want to change it now, it should be in a different branch/story; if we use the default margin 0 pattern for this, then we'll want to be consistent and use it for the other components too, so this will entail going through and individually setting margins (and dealing with resulting fallout!) for a LOT of things, and creating new branches for both interface repos--way out of the scope of a branch that was only meant for adding a couple of new button styles!

border-color: $gray-brown;
}
}
&.sharp {
Copy link
Member

Choose a reason for hiding this comment

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

squared?

@EdwinGuzman
Copy link
Member

Fix the conflicts!

@EdwinGuzman
Copy link
Member

EdwinGuzman commented May 21, 2019 via email

@EdwinGuzman
Copy link
Member

You forgot to update package.json and package-lock.json.

@adriana-alter
Copy link
Contributor Author

Ok--ticket is here.

@adriana-alter adriana-alter merged commit 0600f81 into master May 23, 2019
@EdwinGuzman EdwinGuzman deleted the new-button-styles branch August 29, 2019 19:37
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.

None yet

2 participants