Class: Fluxbit::BottomNavigationComponent::Pagination

Inherits:
Component
  • Object
show all
Includes:
Config::BottomNavigationComponent
Defined in:
app/components/fluxbit/bottom_navigation_component.rb

Overview

Pagination component for bottom navigation

Instance Method Summary collapse

Methods inherited from Component

#add, #add_popover_or_tooltip, #anyicon, #element_name, #fx_id, #icon, #options, #popover?, #random_id, #remove_class, #remove_class_from_props, #render_popover_or_tooltip, #target, #tooltip?

Methods included from IconHelpers

#chevron_double_left, #chevron_double_right, #chevron_down, #chevron_left, #chevron_right, #chevron_up, #close_icon, #ellipsis_horizontal, #eye_icon, #eye_slash_icon, #plus_icon

Constructor Details

#initialize(**props, &block) ⇒ Pagination

Initializes the pagination component.

Parameters:

  • **props (Hash)

    The properties to customize the pagination.

  • props (Hash)

    a customizable set of options

Options Hash (**props):

  • :current_page (Integer) — default: 1

    The current page number.

  • :total_pages (Integer) — default: 1

    The total number of pages.

  • :previous_href (String)

    The URL for the previous page.

  • :next_href (String)

    The URL for the next page.

  • :previous_label (String) — default: "Previous"

    The label for the previous button.

  • :next_label (String) — default: "Next"

    The label for the next button.

  • **props (Hash)

    Remaining options declared as HTML attributes.



299
300
301
302
303
304
305
306
307
308
309
310
# File 'app/components/fluxbit/bottom_navigation_component.rb', line 299

def initialize(**props, &block)
  super(**props, &block)
  @props = props
  @parent_config = @props.delete(:parent_config)

  @current_page = @props.delete(:current_page) || 1
  @total_pages = @props.delete(:total_pages) || 1
  @previous_href = @props.delete(:previous_href) || "#"
  @next_href = @props.delete(:next_href) || "#"
  @previous_label = @props.delete(:previous_label) || "Previous"
  @next_label = @props.delete(:next_label) || "Next"
end

Instance Method Details

#callObject



312
313
314
315
316
317
318
319
320
# File 'app/components/fluxbit/bottom_navigation_component.rb', line 312

def call
  tag.div(class: styles[:pagination][:container]) do
    safe_join([
      render_previous_button,
      render_page_info,
      render_next_button
    ])
  end
end