Class: UI::PaginationPrevious

Inherits:
Phlex::HTML
  • Object
show all
Includes:
PaginationPreviousBehavior
Defined in:
app/components/ui/pagination_previous.rb

Overview

Pagination Previous component (Phlex) 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: {}) ⇒ PaginationPrevious

Returns a new instance of PaginationPrevious.

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
16
# File 'app/components/ui/pagination_previous.rb', line 11

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

Instance Method Details

#view_templateObject



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/components/ui/pagination_previous.rb', line 18

def view_template(&)
  render UI::PaginationLink.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 |s|
      s.path(d: "m15 18-6-6 6-6")
    end
    span(class: "hidden sm:block") { "Previous" }
  end
end