Class: PhlexKit::Pagination
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- PhlexKit::Pagination
- Defined in:
- app/components/phlex_kit/pagination/pagination.rb
Overview
Page navigation. Ported from ruby_ui's RubyUI::Pagination. Compose Pagination > PaginationContent > PaginationItem(href:, active:) / PaginationEllipsis.
Instance Method Summary collapse
-
#initialize(label: "pagination", **attrs) ⇒ Pagination
constructor
label: is a named kwarg (not a mix default) because
mixwould fuse a caller aria-label with the hardcoded "pagination" ("pagination Résultats"). - #view_template ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(label: "pagination", **attrs) ⇒ Pagination
label: is a named kwarg (not a mix default) because mix would fuse a
caller aria-label with the hardcoded "pagination" ("pagination Résultats").
7 8 9 10 |
# File 'app/components/phlex_kit/pagination/pagination.rb', line 7 def initialize(label: "pagination", **attrs) @label = label @attrs = attrs end |
Instance Method Details
#view_template ⇒ Object
12 13 14 15 16 |
# File 'app/components/phlex_kit/pagination/pagination.rb', line 12 def view_template(&) base = { class: "pk-pagination", role: "navigation" } base[:aria] = { label: @label } unless aria_labelled? nav(**mix(base, @attrs), &) end |