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

Editor: Resolve Publish button busy state styling regression #16303

Merged
merged 5 commits into from
Jul 3, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Components: Avoid assigning default styling if explicitly primary
  • Loading branch information
aduth committed Jun 26, 2019
commit 376a2293dede26ceae2e24cfd7a55e3c79a2af84
2 changes: 1 addition & 1 deletion packages/components/src/button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function Button( props, ref ) {

const classes = classnames( 'components-button', className, {
'is-button': isDefault || isPrimary || isLarge || isSmall,
'is-default': isDefault || isLarge || isSmall,
'is-default': ! isPrimary && ( isDefault || isLarge || isSmall ),
Copy link
Member

Choose a reason for hiding this comment

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

Would the condition isDefault || ! isPrimary && ( isLarge || isSmall )also work? I guess when someone passes isDefault there is an expectation the is-default class is added for sure. Otherwise, maybe we can add a small note on https://github.com/WordPress/gutenberg//blob/dd9bf47ff07680d672efc5b31abac268e2cb69c0/packages/components/src/button/README.md#L128 saying the prop is ignored if isPrimary prop is also passed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm, well, the root of the problem is that nobody should ever apply both isPrimary and isDefault, so your expectation may be valid in considering isDefault alone, but not in combination with isPrimary.

That being said, your suggestion still seems like a slight improvement in sensibly mapping isDefault and isPrimary to their respective classes, irrespective the styling conflict which would likely ensue from this choice.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated in cc9a755.

'is-primary': isPrimary,
'is-large': isLarge,
'is-small': isSmall,
Expand Down