Class: Avo::Sidebar::BaseItemComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/avo/sidebar/base_item_component.rb

Direct Known Subclasses

GroupComponent, SectionComponent

Instance Method Summary collapse

Instance Method Details

#after_initializeObject



10
11
12
# File 'app/components/avo/sidebar/base_item_component.rb', line 10

def after_initialize
  @items = @item.items.select(&:visible?)
end

#keyObject



18
19
20
21
22
23
24
25
26
# File 'app/components/avo/sidebar/base_item_component.rb', line 18

def key
  result = "avo.#{request.host}.main_menu.#{@item.name.to_s.underscore}"

  if @item.icon.present?
    result += ".#{@item.icon.parameterize.underscore}"
  end

  result
end

#render?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'app/components/avo/sidebar/base_item_component.rb', line 14

def render?
  @items.any?
end

#section_collapse_data_animationObject



28
29
30
31
32
33
34
35
36
37
# File 'app/components/avo/sidebar/base_item_component.rb', line 28

def section_collapse_data_animation
  {
    transition_enter: "transition ease-out duration-100",
    transition_enter_start: "transform opacity-0 -translate-y-4",
    transition_enter_end: "transform opacity-100 translate-y-0",
    transition_leave: "transition ease-in duration-75",
    transition_leave_start: "transform opacity-100 translate-y-0",
    transition_leave_end: "transform opacity-0 -translate-y-4",
  }
end