Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions UNRELEASED.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ Bump polaris-icons to v4.10.0 ([#4569](https://github.com/Shopify/polaris-react/

### Code quality

Clean up Button styling and $button-filled mixin([#4635](https://github.com/Shopify/polaris-react/pull/4635))

### Deprecations
22 changes: 12 additions & 10 deletions src/components/Button/Button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -111,21 +111,28 @@ $stacking-order: (
margin-left: -($spinner-size / 2);
}

.primary,
.destructive {
@include button-filled;

&.disabled {
@include recolor-icon(var(--p-icon-disabled));
color: var(--p-text-disabled);
box-shadow: none;
border-color: transparent;
}
}

.primary {
--p-button-color: var(--p-action-primary);
--p-button-text: var(--p-text-on-primary);
--p-button-color-hover: var(--p-action-primary-hovered);
--p-button-color-active: var(--p-action-primary-pressed);
--p-button-color-depressed: var(--p-action-primary-depressed);
@include button-filled(color('indigo'), color('indigo', 'dark'));
@include recolor-icon(var(--p-icon-on-primary));

&.disabled {
@include recolor-icon(var(--p-icon-disabled));
background: var(--p-action-primary-disabled);
color: var(--p-text-disabled);
border-color: transparent;
box-shadow: none;
}
}

Expand All @@ -135,15 +142,10 @@ $stacking-order: (
--p-button-color-hover: var(--p-action-critical-hovered);
--p-button-color-active: var(--p-action-critical-pressed);
--p-button-color-depressed: var(--p-action-critical-depressed);
@include button-filled(color('red'), color('red', 'dark'));
@include recolor-icon(var(--p-icon-on-critical));

&.disabled {
@include recolor-icon(var(--p-icon-disabled));
background: var(--p-action-critical-disabled);
color: var(--p-text-disabled);
box-shadow: none;
border-color: transparent;
}
}

Expand Down
4 changes: 1 addition & 3 deletions src/styles/shared/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,8 @@
color: var(--p-text-disabled);
}

@mixin button-filled($button-color, $focus-color, $outline-color: null) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these parameters aren't being used anywhere, removing

@mixin button-filled() {
@include focus-ring($border-width: 0);
$border-color: darken($button-color, 10%);
$active-color: darken($button-color, 15%);
background: var(--p-button-color);
border-width: 0;
border-color: transparent;
Expand Down