Class: UI::PaginationPreviousComponent

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

Overview

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

Instance Method Summary collapse

Methods included from PaginationPreviousBehavior

#previous_additional_classes, #previous_attributes, #previous_classes

Constructor Details

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

Returns a new instance of PaginationPreviousComponent.

Parameters:

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

    URL for the previous 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_previous_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_previous_component.rb', line 17

def call
  render UI::PaginationLinkComponent.new(
    href: @href,
    size: "default",
    classes: previous_classes,
    attributes: previous_attributes
  ) do
    (: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: "m15 18-6-6 6-6")
    end +
      (:span, "Previous", class: "hidden sm:block")
  end
end