Class: FoxTail::DrawerComponent

Inherits:
BaseComponent show all
Includes:
Concerns::HasStimulusController
Defined in:
app/components/fox_tail/drawer_component.rb

Defined Under Namespace

Classes: StimulusController

Instance Attribute Summary

Attributes inherited from BaseComponent

#html_attributes

Instance Method Summary collapse

Methods inherited from BaseComponent

classname_merger, #initialize, stimulus_merger, use_stimulus?, #with_html_attributes, #with_html_class

Methods inherited from Base

fox_tail_config

Constructor Details

This class inherits a constructor from FoxTail::BaseComponent

Instance Method Details

#before_renderObject



47
48
49
50
51
52
53
54
55
56
57
# File 'app/components/fox_tail/drawer_component.rb', line 47

def before_render
  super

  html_attributes[:class] = classnames theme.apply(:root, self),
    open? ? visible_classes : hidden_classes,
    html_class

  html_attributes[:tab_index] ||= -1
  html_attributes[:aria] ||= {}
  html_attributes[:aria][:hidden] = open?
end

#callObject



59
60
61
62
63
64
65
66
# File 'app/components/fox_tail/drawer_component.rb', line 59

def call
   tag_name, html_attributes do
    concat close_button if close_button?
    concat notch if notch?
    yield if block_given?
    concat content
  end
end

#stimulus_controller_optionsObject



68
69
70
71
72
73
74
75
76
77
78
# File 'app/components/fox_tail/drawer_component.rb', line 68

def stimulus_controller_options
  {
    backdrop: backdrop?,
    body_scrolling: body_scrolling?,
    open: open?,
    visible_classes: visible_classes,
    hidden_classes: hidden_classes,
    backdrop_classes: backdrop_classes,
    body_classes: body_classes
  }
end