Class: DaisyUI::Drawer

Inherits:
Base
  • Object
show all
Defined in:
lib/daisy_ui/drawer.rb

Constant Summary

Constants inherited from Base

Base::BOOLS, Base::COLOR_MODIFIERS

Instance Method Summary collapse

Methods inherited from Base

inherited, register_modifiers

Constructor Details

#initialize(id:, as: :section) ⇒ Drawer

Returns a new instance of Drawer.



7
8
9
10
# File 'lib/daisy_ui/drawer.rb', line 7

def initialize(*, id:, as: :section, **)
  super
  @id = id
end

Instance Method Details

#buttonObject



34
35
36
# File 'lib/daisy_ui/drawer.rb', line 34

def button(*, **, &)
  render Button.new(*, as: :label, for: id, **, &)
end

#content(as: :div, **options) ⇒ Object



21
22
23
# File 'lib/daisy_ui/drawer.rb', line 21

def content(as: :div, **options, &)
  public_send(as, class: component_classes("drawer-content", options:), **options, &)
end

#overlay(**options) ⇒ Object



29
30
31
32
# File 'lib/daisy_ui/drawer.rb', line 29

def overlay(**options, &)
  overlay_classes = component_classes("drawer-overlay", options:)
  label(for: id, class: overlay_classes, **options, &)
end

#side(as: :div, **options) ⇒ Object



25
26
27
# File 'lib/daisy_ui/drawer.rb', line 25

def side(as: :div, **options, &)
  public_send(as, class: component_classes("drawer-side", options:), **options, &)
end

#toggle(**options) ⇒ Object



16
17
18
19
# File 'lib/daisy_ui/drawer.rb', line 16

def toggle(**options, &)
  toggle_classes = component_classes("drawer-toggle", options:)
  input(id:, type: :checkbox, class: toggle_classes, **options, &)
end

#view_templateObject



12
13
14
# File 'lib/daisy_ui/drawer.rb', line 12

def view_template(&)
  public_send(as, class: classes, **attributes, &)
end