icons!
This commit is contained in:
@ -2,7 +2,6 @@ defmodule SomethingErlangWeb.ThreadLive.Show do
|
||||
use SomethingErlangWeb, :live_view
|
||||
on_mount SomethingErlangWeb.UserLiveAuth
|
||||
|
||||
alias SomethingErlang.Forums
|
||||
alias SomethingErlang.Grover
|
||||
|
||||
require Logger
|
||||
@ -60,11 +59,11 @@ 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: first_page_disabled_button},
|
||||
%{label: "‹", page: prev_button_target, special: first_page_disabled_button},
|
||||
%{label: "«", page: 1, special: " btn-square" <> first_page_disabled_button},
|
||||
%{label: "‹", page: prev_button_target, special: " btn-square" <> first_page_disabled_button},
|
||||
%{label: "#{page_number}", page: page_number, special: active_page_button},
|
||||
%{label: "›", page: next_button_target, special: last_page_disabled_button},
|
||||
%{label: "»", page: page_count, special: last_page_disabled_button}
|
||||
%{label: "›", page: next_button_target, special: " btn-square" <> last_page_disabled_button},
|
||||
%{label: "»", page: page_count, special: " btn-square" <> last_page_disabled_button}
|
||||
]
|
||||
|
||||
~H"""
|
||||
@ -72,8 +71,16 @@ defmodule SomethingErlangWeb.ThreadLive.Show do
|
||||
<div class="flex-1"></div>
|
||||
<div class="flex-none btn-group">
|
||||
<%= for btn <- buttons do %>
|
||||
<%= live_redirect btn.label, class: "btn btn-sm" <> btn.special,
|
||||
to: Routes.thread_show_path(@socket, :show, @thread.id, page: btn.page) %>
|
||||
<%= 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 />
|
||||
<% "‹" -> %><Icons.chevron_left />
|
||||
<% "›" -> %><Icons.chevron_right />
|
||||
<% "»" -> %><Icons.chevron_right_double />
|
||||
<% _ -> %><%= btn.label %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user