Class: PhlexKit::CarouselItem

Inherits:
BaseComponent show all
Defined in:
app/components/phlex_kit/carousel/carousel_item.rb

Overview

One slide in a PhlexKit::CarouselContent. Full-width/-height by default (basis 100%); override with class: for multi-up layouts. See carousel.rb.

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(**attrs) ⇒ CarouselItem

Returns a new instance of CarouselItem.



5
6
7
# File 'app/components/phlex_kit/carousel/carousel_item.rb', line 5

def initialize(**attrs)
  @attrs = attrs
end

Instance Method Details

#view_templateObject



9
10
11
12
13
14
15
# File 'app/components/phlex_kit/carousel/carousel_item.rb', line 9

def view_template(&)
  base = { class: "pk-carousel-item" }
  # Defaults only when the caller didn't supply their own — `mix` fuses.
  base[:role] = "group" unless attr_set?(:role)
  base[:aria] = { roledescription: "slide" } unless aria_key_set?(:roledescription)
  div(**mix(base, @attrs), &)
end