Skip to content

Commit

Permalink
add pagination_label to page_component
Browse files Browse the repository at this point in the history
  • Loading branch information
yshmarov committed Nov 15, 2023
1 parent 3c5b988 commit 31ea69c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/components/polaris/page_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,17 @@
<% if has_pagination? %>
<div class="Polaris-Page-Header__PaginationWrapper">
<nav aria-label="Pagination">
<%= polaris_button_group(segmented: true) do |group| %>
<%= polaris_button_group(segmented: @pagination_label.blank?) do |group| %>
<% group.with_item do %>
<%= polaris_button(url: @prev_url, outline: true, disabled: @prev_url.blank?) do |button| %>
<% button.with_icon(name: "ChevronLeftMinor") %>
<% end %>
<% end %>
<% if @pagination_label.present? %>
<% group.with_item do %>
<div aria-live="polite"><%= @pagination_label %></div>
<% end %>
<% end %>
<% group.with_item do %>
<%= polaris_button(url: @next_url, outline: true, disabled: @next_url.blank?) do |button| %>
<% button.with_icon(name: "ChevronRightMinor") %>
Expand Down
2 changes: 2 additions & 0 deletions app/components/polaris/page_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def initialize(
back_url: nil,
prev_url: nil,
next_url: nil,
pagination_label: nil,
narrow_width: false,
full_width: false,
divider: false,
Expand All @@ -30,6 +31,7 @@ def initialize(
@back_url = back_url
@prev_url = prev_url
@next_url = next_url
@pagination_label = pagination_label
@narrow_width = narrow_width
@full_width = full_width
@divider = divider
Expand Down

0 comments on commit 31ea69c

Please sign in to comment.