diff --git a/lib/pinchflat/utils/number_utils.ex b/lib/pinchflat/utils/number_utils.ex index fcfb296..4a8404b 100644 --- a/lib/pinchflat/utils/number_utils.ex +++ b/lib/pinchflat/utils/number_utils.ex @@ -3,7 +3,11 @@ defmodule Pinchflat.Utils.NumberUtils do Utility methods for working with numbers """ - # TODO: test + @doc """ + Clamps a number between a minimum and maximum value + + Returns integer() | float() + """ def clamp(num, minimum, maximum) do num |> max(minimum) diff --git a/lib/pinchflat_web/components/custom_components/table_components.ex b/lib/pinchflat_web/components/custom_components/table_components.ex index c1bdc09..532fba1 100644 --- a/lib/pinchflat_web/components/custom_components/table_components.ex +++ b/lib/pinchflat_web/components/custom_components/table_components.ex @@ -53,10 +53,17 @@ defmodule PinchflatWeb.CustomComponents.TableComponents do """ end + @doc """ + Renders simple pagination controls for a table in a liveview. + + ## Examples + + <.live_pagination_controls page_number={@page} total_pages={@total_pages} /> + """ attr :page_number, :integer, default: 1 attr :total_pages, :integer, default: 1 - def pagination_controls(assigns) do + def live_pagination_controls(assigns) do ~H"""