Class: PhlexKit::CalendarPrev

Inherits:
BaseComponent show all
Defined in:
app/components/phlex_kit/calendar/calendar_prev.rb

Overview

Previous-month button, pinned to the header's left edge. See calendar.rb.

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(**attrs) ⇒ CalendarPrev

Returns a new instance of CalendarPrev.



4
5
6
# File 'app/components/phlex_kit/calendar/calendar_prev.rb', line 4

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

Instance Method Details

#view_templateObject



8
9
10
11
12
13
14
15
16
17
18
# File 'app/components/phlex_kit/calendar/calendar_prev.rb', line 8

def view_template
  button(**mix({
    type: :button,
    name: "previous-month",
    class: "pk-calendar-prev",
    aria: { label: "Go to previous month" },
    data: { action: "click->phlex-kit--calendar#prevMonth" }
  }, @attrs)) do
    icon
  end
end