Sha256: d4bc66dbc8a0c2acc06fad2f8256fc1695ec5c50248c06791a06b5523ee1fa5d

Contents?: true

Size: 900 Bytes

Versions: 11

Compression:

Stored size: 900 Bytes

Contents

# frozen_string_literal: true

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

  def initialize(item: nil)
    @item = item
  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

11 entries across 11 versions & 1 rubygems

Version Path
avo-3.11.1 app/components/avo/sidebar/base_item_component.rb
avo-3.11.0 app/components/avo/sidebar/base_item_component.rb
avo-3.10.10 app/components/avo/sidebar/base_item_component.rb
avo-3.10.9 app/components/avo/sidebar/base_item_component.rb
avo-3.10.8 app/components/avo/sidebar/base_item_component.rb
avo-3.10.7 app/components/avo/sidebar/base_item_component.rb
avo-3.10.6 app/components/avo/sidebar/base_item_component.rb
avo-3.10.5 app/components/avo/sidebar/base_item_component.rb
avo-3.10.4 app/components/avo/sidebar/base_item_component.rb
avo-3.10.3 app/components/avo/sidebar/base_item_component.rb
avo-3.10.2 app/components/avo/sidebar/base_item_component.rb