Class: Shadcn::Calendar::Preview

Inherits:
ApplicationViewComponentPreview show all
Defined in:
app/components/shadcn/calendar/preview.rb

Instance Method Summary collapse

Instance Method Details

#bookedObject

Upstream's "Booked dates".



33
34
35
# File 'app/components/shadcn/calendar/preview.rb', line 33

def booked
  render_with_template
end

#custom_cell_sizeObject

Upstream's "Custom Cell Size".



38
39
40
# File 'app/components/shadcn/calendar/preview.rb', line 38

def custom_cell_size
  render_with_template
end

#date_and_timeObject

Upstream's "Date and Time Picker".



28
29
30
# File 'app/components/shadcn/calendar/preview.rb', line 28

def date_and_time
  render_with_template
end

#defaultObject

Upstream's own first example, minus the border it wraps it in: a single month with today selected.



8
9
10
# File 'app/components/shadcn/calendar/preview.rb', line 8

def default
  render_with_template
end

Upstream's "Month and Year Selector".



13
14
15
# File 'app/components/shadcn/calendar/preview.rb', line 13

def dropdown_caption
  render_with_template
end

#in_a_formObject

The hidden inputs a Rails form posts.



48
49
50
# File 'app/components/shadcn/calendar/preview.rb', line 48

def in_a_form
  render_with_template
end

#month(month: "2026-09-01") ⇒ Object

The month is an argument here so a month can be asked for by URL. That is what spec/system/calendar_spec.rb compares the browser's own render against: the grid exists twice — in Calendar::Month and in the controller — and the only thing that keeps the two honest is asking the server what it would have drawn.

Parameters:

  • month (defaults to: "2026-09-01")

    text



59
60
61
# File 'app/components/shadcn/calendar/preview.rb', line 59

def month(month: "2026-09-01")
  render_component(month: Date.parse(month), class: "rounded-md border shadow-sm")
end

#presetsObject

Upstream's "Presets".



23
24
25
# File 'app/components/shadcn/calendar/preview.rb', line 23

def presets
  render_with_template
end

#rangeObject

Upstream's "Range Calendar".



18
19
20
# File 'app/components/shadcn/calendar/preview.rb', line 18

def range
  render_with_template
end

#week_numbersObject

Upstream's "Week Numbers".



43
44
45
# File 'app/components/shadcn/calendar/preview.rb', line 43

def week_numbers
  render_with_template
end