Class: Ui::Pagination::Component::PageItem

Inherits:
BaseComponent
  • Object
show all
Defined in:
lib/uikit_rails/templates/components/pagination/component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(href: "#", active: false, **html_attrs) ⇒ PageItem

Returns a new instance of PageItem.



30
31
32
33
34
35
# File 'lib/uikit_rails/templates/components/pagination/component.rb', line 30

def initialize(href: "#", active: false, **html_attrs)
  @href = href
  @active = active
  @html_attrs = html_attrs
  super()
end

Instance Attribute Details

#activeObject (readonly)

Returns the value of attribute active.



28
29
30
# File 'lib/uikit_rails/templates/components/pagination/component.rb', line 28

def active
  @active
end

#hrefObject (readonly)

Returns the value of attribute href.



28
29
30
# File 'lib/uikit_rails/templates/components/pagination/component.rb', line 28

def href
  @href
end

#html_attrsObject (readonly)

Returns the value of attribute html_attrs.



28
29
30
# File 'lib/uikit_rails/templates/components/pagination/component.rb', line 28

def html_attrs
  @html_attrs
end

Instance Method Details

#callObject



37
38
39
40
# File 'lib/uikit_rails/templates/components/pagination/component.rb', line 37

def call
  (:a, content, class: class_names("ui-pagination__item", "ui-pagination__item--active": active),
                           href: href, "aria-current": ("page" if active), **html_attrs)
end