Class: UI::PaginationLinkComponent

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

Overview

Pagination Link component (ViewComponent) Clickable link for page numbers

Instance Method Summary collapse

Methods included from PaginationLinkBehavior

#link_base_classes, #link_classes, #link_html_attributes, #link_size_classes, #link_variant_classes

Constructor Details

#initialize(href: "#", active: false, size: "icon", classes: "", attributes: {}) ⇒ PaginationLinkComponent

Returns a new instance of PaginationLinkComponent.

Parameters:

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

    URL for the link

  • active (Boolean) (defaults to: false)

    whether this link is for the current page

  • size (String) (defaults to: "icon")

    size variant: “icon”, “default”, “sm”, “lg”

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

    additional CSS classes

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

    additional HTML attributes



13
14
15
16
17
18
19
# File 'app/view_components/ui/pagination_link_component.rb', line 13

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

Instance Method Details

#callObject



21
22
23
24
25
# File 'app/view_components/ui/pagination_link_component.rb', line 21

def call
   :a, **link_html_attributes do
    content
  end
end