Class: ShadcnPhlexcomponents::PaginationNext

Inherits:
Base
  • Object
show all
Defined in:
lib/shadcn_phlexcomponents/components/pagination.rb

Constant Summary

Constants inherited from Base

Base::SANITIZER_ALLOWED_ATTRIBUTES, Base::SANITIZER_ALLOWED_TAGS, Base::TAILWIND_MERGER

Instance Method Summary collapse

Methods inherited from Base

#before_template, #convert_collection_hash_to_struct, #find_as_child, #icon, #item_disabled?, #merge_default_attributes, #merged_as_child_attributes, #nokogiri_attributes_to_hash, #overlay, #sanitize_as_child

Constructor Details

#initialize(options = nil, html_options = nil) ⇒ PaginationNext

Returns a new instance of PaginationNext.



102
103
104
105
# File 'lib/shadcn_phlexcomponents/components/pagination.rb', line 102

def initialize(options = nil, html_options = nil)
  @options = options
  @html_options = html_options
end

Instance Method Details

#default_attributesObject



107
108
109
110
111
112
113
# File 'lib/shadcn_phlexcomponents/components/pagination.rb', line 107

def default_attributes
  {
    aria: {
      label: "Go to next page",
    },
  }
end

#view_templateObject



115
116
117
118
119
120
121
122
123
124
125
# File 'lib/shadcn_phlexcomponents/components/pagination.rb', line 115

def view_template
  @html_options ||= {}
  @html_options = mix(default_attributes, @html_options)
  @html_options[:class] = class_variants(class: @html_options[:class])
  @html_options[:size] = :default

  PaginationLink(@options, @html_options) do
    span(class: "hidden sm:block") { "Next" }
    icon("chevron-right")
  end
end