Class: Flowbite::Pagination::Link
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Flowbite::Pagination::Link
- Defined in:
- app/components/flowbite/pagination/link.rb
Overview
Renders a single page number link in a pagination component.
This is automatically used by Flowbite::Pagination, but can be used standalone if needed.
Instance Attribute Summary collapse
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
- #current? ⇒ Boolean
-
#initialize(page:, url:, current: false) ⇒ Link
constructor
A new instance of Link.
Constructor Details
#initialize(page:, url:, current: false) ⇒ Link
Returns a new instance of Link.
29 30 31 32 33 |
# File 'app/components/flowbite/pagination/link.rb', line 29 def initialize(page:, url:, current: false) @current = current @page = page @url = url end |
Instance Attribute Details
#page ⇒ Object (readonly)
Returns the value of attribute page.
27 28 29 |
# File 'app/components/flowbite/pagination/link.rb', line 27 def page @page end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
27 28 29 |
# File 'app/components/flowbite/pagination/link.rb', line 27 def url @url end |
Class Method Details
.classes(current: false) ⇒ Object
18 19 20 21 22 23 24 |
# File 'app/components/flowbite/pagination/link.rb', line 18 def classes(current: false) if current ["flex", "items-center", "justify-center", "text-fg-brand", "bg-neutral-tertiary-medium", "box-border", "border", "border-default-medium", "hover:text-fg-brand", "font-medium", "text-sm", "w-9", "h-9", "focus:outline-none"] else ["flex", "items-center", "justify-center", "text-body", "bg-neutral-secondary-medium", "box-border", "border", "border-default-medium", "hover:bg-neutral-tertiary-medium", "hover:text-heading", "font-medium", "text-sm", "w-9", "h-9", "focus:outline-none"] end end |
Instance Method Details
#call ⇒ Object
35 36 37 |
# File 'app/components/flowbite/pagination/link.rb', line 35 def call content_tag(:li) { render_link } end |
#current? ⇒ Boolean
39 40 41 |
# File 'app/components/flowbite/pagination/link.rb', line 39 def current? !!@current end |