Class: Shadcn::Pagination::Previous::Component
- Inherits:
-
Link::Component
- Object
- ViewComponent::Base
- ApplicationViewComponent
- Link::Component
- Shadcn::Pagination::Previous::Component
- Defined in:
- app/components/shadcn/pagination/previous/component.rb
Overview
PaginationPrevious
Constant Summary collapse
- EXTRA_CLASSES =
"gap-1 px-2.5 sm:pl-2.5"
Constants inherited from ApplicationViewComponent
ApplicationViewComponent::CONTENTS_STYLE, ApplicationViewComponent::VOID_TAGS
Instance Attribute Summary
Attributes inherited from Link::Component
Attributes inherited from ApplicationViewComponent
Instance Method Summary collapse
- #call ⇒ Object
- #css_classes(extra = nil) ⇒ Object
- #element_attributes(**defaults) ⇒ Object
-
#initialize(**attributes) ⇒ Component
constructor
A new instance of Component.
Methods inherited from ApplicationViewComponent
default_tag, #merged_style, #render_element, #shadcn_t, slot_name, #style_variants, #tag_name
Constructor Details
#initialize(**attributes) ⇒ Component
Returns a new instance of Component.
10 11 12 |
# File 'app/components/shadcn/pagination/previous/component.rb', line 10 def initialize(**attributes) super(size: :default, **attributes) end |
Instance Method Details
#call ⇒ Object
22 23 24 25 26 27 |
# File 'app/components/shadcn/pagination/previous/component.rb', line 22 def call render_element(body: safe_join([ render(Icon::Component.new("chevron-left")), tag.span(shadcn_t("pagination.previous"), class: "hidden sm:block") ])) end |
#css_classes(extra = nil) ⇒ Object
18 19 20 |
# File 'app/components/shadcn/pagination/previous/component.rb', line 18 def css_classes(extra = nil) super(ShadcnViewComponent.cn(EXTRA_CLASSES, extra)) end |
#element_attributes(**defaults) ⇒ Object
14 15 16 |
# File 'app/components/shadcn/pagination/previous/component.rb', line 14 def element_attributes(**defaults) super(**{ "aria-label" => shadcn_t("pagination.go_to_previous") }.merge(defaults)) end |