refactor pagination buttons
This commit is contained in:
@ -83,30 +83,15 @@ defmodule SomethingErlangWeb.ThreadLive do
|
||||
"""
|
||||
end
|
||||
|
||||
defp label_button(%{label: "«", page: page} = assigns),
|
||||
do: ~H"""
|
||||
<.icon name="hero-chevron-double-left-mini" /><%= page %>
|
||||
"""
|
||||
|
||||
defp label_button(%{label: "‹", page: page} = assigns),
|
||||
do: ~H"""
|
||||
<.icon name="hero-chevron-left-mini" /><%= page %>
|
||||
"""
|
||||
|
||||
defp label_button(%{label: "›", page: page} = assigns),
|
||||
do: ~H"""
|
||||
<%= page %><.icon name="hero-chevron-right-mini" />
|
||||
"""
|
||||
|
||||
defp label_button(%{label: "»", page: page} = assigns),
|
||||
do: ~H"""
|
||||
<%= page %><.icon name="hero-chevron-double-right-mini" />
|
||||
"""
|
||||
|
||||
defp label_button(%{page: page} = assigns),
|
||||
do: ~H"""
|
||||
<%= page %>
|
||||
"""
|
||||
defp label_button(%{label: label} = assigns) do
|
||||
case label do
|
||||
"«" -> ~H{<.icon name="hero-chevron-double-left-mini" /><%= @page %>}
|
||||
"‹" -> ~H{<.icon name="hero-chevron-left-mini" /><%= @page %>}
|
||||
"›" -> ~H{<%= @page %><.icon name="hero-chevron-right-mini" />}
|
||||
"»" -> ~H{<%= @page %><.icon name="hero-chevron-double-right-mini" />}
|
||||
_ -> ~H{<%= @page %>}
|
||||
end
|
||||
end
|
||||
|
||||
defp buttons(thread) do
|
||||
%{page: page_number, page_count: page_count} = thread
|
||||
|
Reference in New Issue
Block a user