Class: JetUi::Pagy::Component

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/jet_ui/pagy/component.rb

Constant Summary collapse

WRAPPER_CLASSES =
'flex flex-col md:items-center gap-x-6 gap-y-2 md:justify-between md:flex-row'

Instance Method Summary collapse

Constructor Details

#initialize(pagy:, **options) ⇒ Component

Returns a new instance of Component.



8
9
10
11
# File 'app/components/jet_ui/pagy/component.rb', line 8

def initialize(pagy:, **options)
  @pagy    = pagy
  @options = options
end

Instance Method Details

#callObject



17
18
19
20
21
# File 'app/components/jet_ui/pagy/component.rb', line 17

def call
   :div, class: class_names(WRAPPER_CLASSES, @options.delete(:class)), **@options do
    safe_join([page_info, nav_wrapper])
  end
end

#render?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'app/components/jet_ui/pagy/component.rb', line 13

def render?
  @pagy.pages > 1
end