Skip to content

Commit

Permalink
✨🥔 Components: Expose ButtonComponent#danger variant
Browse files Browse the repository at this point in the history
- #1187

As part of #1592 I needed
a Button that used the `dange` variant and all the turbo-y goodness.

So I pulled a variant into the `ButtonComponent`; and then we can search
for `--danger` and purge them.
  • Loading branch information
zspencer committed Jun 25, 2023
1 parent 51ff6f3 commit 0095772
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/components/button_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
class ButtonComponent < ApplicationComponent
SCHEME_MAPPINGS = {
primary: :primary_classes,
secondary: :secondary_classes
secondary: :secondary_classes,
danger: :danger_classes
}.with_indifferent_access.freeze

def initialize(
Expand Down Expand Up @@ -61,6 +62,7 @@ def base_classes
"shadow-sm",
"ring-1",
"ring-inset",
"text-center",
"no-underline",
"focus-visible:outline",
"focus-visible:outline-2",
Expand All @@ -79,6 +81,10 @@ def secondary_classes
]
end

def danger_classes
["bg-danger-500 hover:bg-danger-700 active:bg-danger-200 text-white"]
end

def primary_classes
[
"bg-purple-600",
Expand Down

0 comments on commit 0095772

Please sign in to comment.