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



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

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

#keyObject



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

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)


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

def render?
  @items.any?
end

#section_collapse_data_animationObject



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

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