Sha256: 3e4143d07e9be0a9429150be6bfadb09f9a330cd17bc17a8ebd9a70831a2d3bb

Contents?: true

Size: 944 Bytes

Versions: 6

Compression:

Stored size: 944 Bytes

Contents

# frozen_string_literal: true

class Avo::Sidebar::BaseItemComponent < Avo::BaseComponent
  attr_reader :item, :items
  delegate :collapsable, :collapsed, to: :@item

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

  def render?
    items.any?
  end

  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

  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
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
avo-3.11.7 app/components/avo/sidebar/base_item_component.rb
avo-3.11.6 app/components/avo/sidebar/base_item_component.rb
avo-3.11.5 app/components/avo/sidebar/base_item_component.rb
avo-3.11.4 app/components/avo/sidebar/base_item_component.rb
avo-3.11.3 app/components/avo/sidebar/base_item_component.rb
avo-3.11.2 app/components/avo/sidebar/base_item_component.rb