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
|
||||
|
||||
attr :pagination_params, :map, required: true
|
||||
attr :id, :atom, required: true
|
||||
|
||||
def pagination(assigns) do
|
||||
page_links = generate_page_links(assigns.pagination_params)
|
||||
@@ -11,7 +12,7 @@ defmodule MusicLibraryWeb.Pagination do
|
||||
|
||||
~H"""
|
||||
<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"
|
||||
>
|
||||
<%!-- Only on smallest viewport --%>
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
of <b><%= @record_list_params.total_entries %></b>
|
||||
records
|
||||
</p>
|
||||
|
||||
<.table
|
||||
id="records"
|
||||
rows={@streams.records}
|
||||
@@ -108,4 +109,4 @@
|
||||
/>
|
||||
</.modal>
|
||||
|
||||
<.pagination pagination_params={@record_list_params} />
|
||||
<.pagination id={:bottom_pagination} pagination_params={@record_list_params} />
|
||||
|
||||
Reference in New Issue
Block a user