Class: BetterUi::General::Pagination::Component
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- BetterUi::General::Pagination::Component
- Defined in:
- app/components/better_ui/general/pagination/component.rb
Constant Summary collapse
- PAGINATION_THEME =
Costanti per temi
{ default: { container: 'border-gray-300', page: 'border-gray-300 text-gray-500 hover:bg-gray-50 hover:text-gray-700', current: 'border-blue-500 bg-blue-50 text-blue-600', disabled: 'border-gray-300 text-gray-300 cursor-not-allowed' }, blue: { container: 'border-blue-300', page: 'border-blue-300 text-blue-600 hover:bg-blue-50 hover:text-blue-700', current: 'border-blue-500 bg-blue-100 text-blue-700', disabled: 'border-blue-200 text-blue-300 cursor-not-allowed' }, red: { container: 'border-red-300', page: 'border-red-300 text-red-600 hover:bg-red-50 hover:text-red-700', current: 'border-red-500 bg-red-100 text-red-700', disabled: 'border-red-200 text-red-300 cursor-not-allowed' }, green: { container: 'border-green-300', page: 'border-green-300 text-green-600 hover:bg-green-50 hover:text-green-700', current: 'border-green-500 bg-green-100 text-green-700', disabled: 'border-green-200 text-green-300 cursor-not-allowed' }, yellow: { container: 'border-yellow-300', page: 'border-yellow-300 text-yellow-600 hover:bg-yellow-50 hover:text-yellow-700', current: 'border-yellow-500 bg-yellow-100 text-yellow-700', disabled: 'border-yellow-200 text-yellow-300 cursor-not-allowed' }, violet: { container: 'border-violet-300', page: 'border-violet-300 text-violet-600 hover:bg-violet-50 hover:text-violet-700', current: 'border-violet-500 bg-violet-100 text-violet-700', disabled: 'border-violet-200 text-violet-300 cursor-not-allowed' }, orange: { container: 'border-orange-300', page: 'border-orange-300 text-orange-600 hover:bg-orange-50 hover:text-orange-700', current: 'border-orange-500 bg-orange-100 text-orange-700', disabled: 'border-orange-200 text-orange-300 cursor-not-allowed' }, rose: { container: 'border-rose-300', page: 'border-rose-300 text-rose-600 hover:bg-rose-50 hover:text-rose-700', current: 'border-rose-500 bg-rose-100 text-rose-700', disabled: 'border-rose-200 text-rose-300 cursor-not-allowed' }, white: { container: 'border-white', page: 'border-white text-gray-700 hover:bg-white hover:text-gray-900', current: 'border-white bg-white text-gray-900', disabled: 'border-white text-gray-400 cursor-not-allowed' } }.freeze
- PAGINATION_SIZE =
Costanti per dimensioni
{ small: 'px-2 py-1 text-sm', medium: 'px-3 py-2 text-base', large: 'px-4 py-3 text-lg' }.freeze
Instance Method Summary collapse
-
#initialize(current_page:, total_pages:, path:, theme: :default, size: :medium, window: 2, show_info: false, per_page: nil, classes: '', **options) ⇒ Component
constructor
A new instance of Component.
Constructor Details
#initialize(current_page:, total_pages:, path:, theme: :default, size: :medium, window: 2, show_info: false, per_page: nil, classes: '', **options) ⇒ Component
Returns a new instance of Component.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'app/components/better_ui/general/pagination/component.rb', line 74 def initialize(current_page:, total_pages:, path:, theme: :default, size: :medium, window: 2, show_info: false, per_page: nil, classes: '', **) @current_page = current_page.to_i @total_pages = total_pages.to_i @path = path @theme = theme @size = size @window = window.to_i @show_info = show_info @per_page = per_page @classes = classes @options = validate_params end |