-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reimplement the pagination as
ui/button
components
- Switch some ARIA attributes to semantic HTML - added `rel="prev"` and `rel="next"` - added text visible only to screen-readers - use aria-disabled
- Loading branch information
Showing
5 changed files
with
49 additions
and
56 deletions.
There are no files selected for viewing
53 changes: 24 additions & 29 deletions
53
admin/app/components/solidus_admin/ui/table/pagination/component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,24 @@ | ||
<div> | ||
<nav aria-label="pagination"> | ||
<ul class="flex items-center"> | ||
<li> | ||
<% if @prev_link.blank? %> | ||
<span class="<%= link_classes(rounded: :left) %>", "aria-label"=<%= t(".prev") %>, "aria-disabled"=true> | ||
<%= icon_tag("arrow-left-s-line", class: "fill-current text-grey-400 w-5 h-5") %> | ||
</span> | ||
<% else %> | ||
<%= link_to @prev_link, class: link_classes(rounded: :left), "aria-label" => t(".prev") do %> | ||
<%= icon_tag("arrow-left-s-line", class: "w-5 h-5") %> | ||
<% end %> | ||
<% end %> | ||
</li> | ||
|
||
<li> | ||
<% if @next_link.blank? %> | ||
<span class="<%= link_classes(rounded: :right) %>", "aria-label"=<%= t(".next") %>, "aria-disabled"=true> | ||
<%= icon_tag("arrow-right-s-line", class: "fill-current text-grey-400 w-5 h-5") %> | ||
</span> | ||
<% else %> | ||
<%= link_to @next_link, class: link_classes(rounded: :right), "aria-label" => t(".next") do %> | ||
<%= icon_tag("arrow-right-s-line", class: "w-5 h-5") %> | ||
<% end %> | ||
<% end %> | ||
</li> | ||
</ul> | ||
</nav> | ||
</div> | ||
<nav aria-label="pagination" class="flex items-center"> | ||
<%= render component('ui/button').new( | ||
icon: 'arrow-left-s-line', | ||
class: 'rounded-tr-none rounded-br-none border-r-0', | ||
scheme: :secondary, | ||
size: :s, | ||
tag: :a, | ||
href: @prev_link, | ||
'aria-disabled': @prev_link.blank?, | ||
rel: 'prev', | ||
text: content_tag(:span, t('.previous'), class: 'sr-only'), | ||
) -%> | ||
<%= render component('ui/button').new( | ||
icon: 'arrow-right-s-line', | ||
class: 'rounded-tl-none rounded-bl-none', | ||
scheme: :secondary, | ||
size: :s, | ||
tag: :a, | ||
href: @next_link, | ||
'aria-disabled': @next_link.blank?, | ||
rel: 'next', | ||
text: content_tag(:span, t('.next'), class: 'sr-only'), | ||
) %> | ||
</nav> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
admin/spec/components/previews/solidus_admin/ui/button/component_preview/group.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<%= render current_component.new( | ||
tag: :a, | ||
rel: 'prev', | ||
href: '#', | ||
icon: 'arrow-left-s-line', | ||
class: 'rounded-tr-none rounded-br-none border-r-0', | ||
scheme: :secondary, | ||
size: :s | ||
) -%> | ||
<%= render current_component.new( | ||
tag: :a, | ||
rel: 'next', | ||
icon: 'arrow-right-s-line', | ||
class: 'rounded-tl-none rounded-bl-none', | ||
scheme: :secondary, | ||
size: :s, | ||
'aria-disabled': true | ||
) %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters