Class: Trek::MenuComponent::SectionComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/trek/menu_component.rb

Defined Under Namespace

Classes: ItemComponent

Instance Method Summary collapse

Methods included from StimulusHelpers

#stimulus_action, #stimulus_class, #stimulus_class_hash, #stimulus_class_key, #stimulus_target, #stimulus_target_hash, #stimulus_target_key, #stimulus_value, #stimulus_value_hash, #stimulus_value_key

Methods included from CssClassesHelpers

#class_for, #class_names_for, #root_class

Methods included from IdentifierHelper

#identifier

Instance Method Details

#callObject



35
36
37
38
39
40
# File 'app/components/trek/menu_component.rb', line 35

def call
  tag.div(
    safe_join([rendered_title, rendered_items].compact),
    class: root_class
  )
end

#render?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'app/components/trek/menu_component.rb', line 31

def render?
  items.any?(&:render?)
end

#rendered_itemsObject



49
50
51
52
53
54
# File 'app/components/trek/menu_component.rb', line 49

def rendered_items
  tag.ul(
    safe_join(items),
    class: class_for("items")
  )
end

#rendered_titleObject



42
43
44
45
46
47
# File 'app/components/trek/menu_component.rb', line 42

def rendered_title
  tag.div(
    title,
    class: class_for("title")
  )
end