Allow pagination component to be used multiple times
Enables further experimentation with multiple pagination controls on the same page (not necessarily a good idea).
This commit is contained in:
@@ -4,6 +4,7 @@ defmodule MusicLibraryWeb.Pagination do
|
|||||||
use Gettext, backend: MusicLibraryWeb.Gettext
|
use Gettext, backend: MusicLibraryWeb.Gettext
|
||||||
|
|
||||||
attr :pagination_params, :map, required: true
|
attr :pagination_params, :map, required: true
|
||||||
|
attr :id, :atom, required: true
|
||||||
|
|
||||||
def pagination(assigns) do
|
def pagination(assigns) do
|
||||||
page_links = generate_page_links(assigns.pagination_params)
|
page_links = generate_page_links(assigns.pagination_params)
|
||||||
@@ -11,7 +12,7 @@ defmodule MusicLibraryWeb.Pagination do
|
|||||||
|
|
||||||
~H"""
|
~H"""
|
||||||
<div
|
<div
|
||||||
id="pagination"
|
id={@id}
|
||||||
class="flex items-center justify-between border-t border-zinc-200 bg-white px-4 py-6 sm:px-6 mb-4"
|
class="flex items-center justify-between border-t border-zinc-200 bg-white px-4 py-6 sm:px-6 mb-4"
|
||||||
>
|
>
|
||||||
<%!-- Only on smallest viewport --%>
|
<%!-- Only on smallest viewport --%>
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
of <b><%= @record_list_params.total_entries %></b>
|
of <b><%= @record_list_params.total_entries %></b>
|
||||||
records
|
records
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<.table
|
<.table
|
||||||
id="records"
|
id="records"
|
||||||
rows={@streams.records}
|
rows={@streams.records}
|
||||||
@@ -108,4 +109,4 @@
|
|||||||
/>
|
/>
|
||||||
</.modal>
|
</.modal>
|
||||||
|
|
||||||
<.pagination pagination_params={@record_list_params} />
|
<.pagination id={:bottom_pagination} pagination_params={@record_list_params} />
|
||||||
|
|||||||
Reference in New Issue
Block a user