pagination contains more numbers now
This commit is contained in:
@ -41,6 +41,10 @@ body {
|
||||
@apply mb-1;
|
||||
}
|
||||
|
||||
.pagination i {
|
||||
@apply h-5 px-1;
|
||||
}
|
||||
|
||||
/* Alerts and form errors used by phx.new */
|
||||
.alert {
|
||||
padding: 15px;
|
||||
|
@ -68,25 +68,25 @@ defmodule SomethingErlangWeb.ThreadLive.Show do
|
||||
next_button_target = if page_number < page_count, do: page_number + 1, else: page_count
|
||||
|
||||
buttons = [
|
||||
%{label: "«", page: 1, special: " btn-square" <> first_page_disabled_button},
|
||||
%{label: "‹", page: prev_button_target, special: " btn-square" <> first_page_disabled_button},
|
||||
%{label: "«", page: 1, special: "" <> first_page_disabled_button},
|
||||
%{label: "‹", page: prev_button_target, special: "" <> first_page_disabled_button},
|
||||
%{label: "#{page_number}", page: page_number, special: active_page_button},
|
||||
%{label: "›", page: next_button_target, special: " btn-square" <> last_page_disabled_button},
|
||||
%{label: "»", page: page_count, special: " btn-square" <> last_page_disabled_button}
|
||||
%{label: "›", page: next_button_target, special: "" <> last_page_disabled_button},
|
||||
%{label: "»", page: page_count, special: "" <> last_page_disabled_button}
|
||||
]
|
||||
|
||||
~H"""
|
||||
<div class="navbar my-4 bg-base-200">
|
||||
<div class="flex-1"></div>
|
||||
<div class="flex-none btn-group">
|
||||
<div class="pagination flex-none btn-group">
|
||||
<%= for btn <- buttons do %>
|
||||
<%= live_redirect class: "btn btn-sm" <> btn.special,
|
||||
to: Routes.thread_show_path(@socket, :show, @thread.id, page: btn.page) do %>
|
||||
<%= case btn.label do %>
|
||||
<% "«" -> %><Icons.chevron_left_double />
|
||||
<% "«" -> %>1 <Icons.chevron_left_double />
|
||||
<% "‹" -> %><Icons.chevron_left />
|
||||
<% "›" -> %><Icons.chevron_right />
|
||||
<% "»" -> %><Icons.chevron_right_double />
|
||||
<% "»" -> %><Icons.chevron_right_double /> <%= page_count %>
|
||||
<% _ -> %><%= btn.label %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
Reference in New Issue
Block a user