Skip to content

Commit

Permalink
Add support for "aria-current" to ui/button
Browse files Browse the repository at this point in the history
  • Loading branch information
elia committed Nov 30, 2023
1 parent 6b2c6ed commit 5c98c8a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
8 changes: 4 additions & 4 deletions admin/app/components/solidus_admin/ui/button/component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,31 @@ class SolidusAdmin::UI::Button::Component < SolidusAdmin::BaseComponent
primary: %{
text-white bg-black
hover:text-white hover:bg-gray-600
active:text-white active:bg-gray-800
active:text-white active:bg-gray-800 aria-current:text-white aria-current:bg-gray-800
focus:text-white focus:bg-gray-700
disabled:text-gray-400 disabled:bg-gray-100
aria-disabled:text-gray-400 aria-disabled:bg-gray-100
},
secondary: %{
text-gray-700 bg-white border border-1 border-gray-200
hover:bg-gray-50
active:bg-gray-100
active:bg-gray-100 aria-current:bg-gray-100
focus:bg-gray-50
disabled:text-gray-300 disabled:bg-white
aria-disabled:text-gray-300 aria-disabled:bg-white
},
danger: %{
text-red-500 bg-white border border-1 border-red-500
hover:bg-red-500 hover:border-red-600 hover:text-white
active:bg-red-600 active:border-red-700 active:text-white
active:bg-red-600 active:border-red-700 active:text-white aria-current:bg-red-600 aria-current:border-red-700 aria-current:text-white
focus:bg-red-50 focus:bg-red-500 focus:border-red-600 focus:text-white
disabled:text-red-300 disabled:bg-white disabled:border-red-200
aria-disabled:text-red-300 aria-disabled:bg-white aria-disabled:border-red-200
},
ghost: %{
text-gray-700 bg-transparent
hover:bg-gray-50
active:bg-gray-100
active:bg-gray-100 aria-current:bg-gray-100
focus:bg-gray-50 focus:ring-gray-300 focus:ring-2
disabled:text-gray-300 disabled:bg-transparent disabled:border-gray-300
aria-disabled:text-gray-300 aria-disabled:bg-transparent aria-disabled:border-gray-300
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<td class="px-3 py-1 text-gray-500 text-center text-[16px]"><%= size.to_s.humanize %></td>
<% end %>
</tr>
<% %i[default disabled].each do |state| %>
<% %i[default disabled current].each do |state| %>
<tr>
<td class="font-bold px-3 py-1"><%= state.to_s.humanize %></td>
<% current_component::SIZES.keys.each do |size| %>
Expand All @@ -21,13 +21,14 @@
scheme: scheme,
text: text,
icon: ('search-line' if show_icon),
disabled: state == :disabled
disabled: state == :disabled,
"aria-current": state == :current ? true : nil,
) %>
</td>
<% end %>
</tr>
<% end %>
<% %i[default disabled].each do |state| %>
<% %i[default disabled current].each do |state| %>
<tr>
<td class="font-bold px-3 py-1"><%= state.to_s.humanize %></td>
<% current_component::SIZES.keys.each do |size| %>
Expand All @@ -36,7 +37,8 @@
size: size,
scheme: scheme,
icon: ('filter-3-line' if show_icon),
disabled: state == :disabled
disabled: state == :disabled,
"aria-current": state == :current ? true : nil,
) %>
</td>
<% end %>
Expand Down

0 comments on commit 5c98c8a

Please sign in to comment.