Class: PhlexKit::CarouselPrevious

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

Overview

Previous-slide button — an outline icon PhlexKit::Button anchored outside the track edge (rotated 90° for vertical carousels). Starts disabled; the controller enables it once there is somewhere to scroll. See carousel.rb.

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(**attrs) ⇒ CarouselPrevious

Returns a new instance of CarouselPrevious.



6
7
8
# File 'app/components/phlex_kit/carousel/carousel_previous.rb', line 6

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

Instance Method Details

#view_templateObject



10
11
12
13
14
15
16
17
18
# File 'app/components/phlex_kit/carousel/carousel_previous.rb', line 10

def view_template
  render Button.new(variant: :outline, icon: true, disabled: true, **mix({
    class: "pk-carousel-previous",
    data: { action: "click->phlex-kit--carousel#scrollPrev", phlex_kit__carousel_target: "prevButton" }
  }, @attrs)) do
    icon
    span(class: "pk-sr-only") { "Previous slide" }
  end
end