Class: UI::PaginationNextComponent

Inherits:
ViewComponent::Base
  • Object
show all
Includes:
PaginationNextBehavior
Defined in:
app/view_components/ui/pagination_next_component.rb

Overview

Pagination Next component (ViewComponent) Next page button with icon and text

Instance Method Summary collapse

Methods included from PaginationNextBehavior

#next_additional_classes, #next_attributes, #next_classes

Constructor Details

#initialize(href: "#", classes: "", attributes: {}) ⇒ PaginationNextComponent

Returns a new instance of PaginationNextComponent.

Parameters:

  • href (String) (defaults to: "#")

    URL for the next page

  • classes (String) (defaults to: "")

    additional CSS classes

  • attributes (Hash) (defaults to: {})

    additional HTML attributes



11
12
13
14
15
# File 'app/view_components/ui/pagination_next_component.rb', line 11

def initialize(href: "#", classes: "", attributes: {})
  @href = href
  @classes = classes
  @attributes = attributes
end

Instance Method Details

#callObject



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/view_components/ui/pagination_next_component.rb', line 17

def call
  render UI::PaginationLinkComponent.new(
    href: @href,
    size: "default",
    classes: next_classes,
    attributes: next_attributes
  ) do
    (:span, "Next", class: "hidden sm:block") +
      (:svg, xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", class: "size-4") do
        (:path, nil, d: "m9 18 6-6-6-6")
      end
  end
end