Skip to content

Commit

Permalink
Merge pull request #436 from remy727/feature/button-non-primary-destr…
Browse files Browse the repository at this point in the history
…uctive

Support non-primary destructive button
  • Loading branch information
kirillplatonov authored Aug 10, 2024
2 parents f13db88 + 31290f7 commit 19f6287
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
12 changes: 8 additions & 4 deletions app/assets/stylesheets/polaris_view_components.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion app/assets/stylesheets/polaris_view_components/button.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ html[class~="Polaris-Summer-Editions-2023"] .Polaris-Button {
}

/* Destructive */
&.Polaris-Button--destructive,
&.Polaris-Button--destructive:is(.Polaris-Button--primary) {
--pc-button-color: var(--p-color-bg-fill-critical);
--pc-button-text: var(--p-color-bg-surface);
Expand All @@ -68,6 +67,13 @@ html[class~="Polaris-Summer-Editions-2023"] .Polaris-Button {
}
}

&.Polaris-Button--destructive:not(.Polaris-Button--primary) {
--pc-button-color: var(--p-color-text-critical);
--pc-button-color-hover: var(--p-color-text-critical-hover);
--pc-button-color-active: var(--p-color-text-critical-active);
--pc-button-icon-fill: currentColor;
}

/* Primary */
&.Polaris-Button--primary {
--pc-button-bg-gradient: var(--p-color-button-gradient-bg-fill);
Expand Down
3 changes: 3 additions & 0 deletions demo/app/previews/button_component_preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ def plain_destructive
def primary
end

def primary_destructive
end

def destructive
end

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%= polaris_button(primary: true, destructive: true) { "Delete theme" } %>

0 comments on commit 19f6287

Please sign in to comment.