Sha256: a037bf9d61ca2de18cb855207e0231d1fab5dacc1abe0c54dad62c70553d6851

Contents?: true

Size: 1.14 KB

Versions: 33

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true

class Avo::PanelComponent < ViewComponent::Base
  attr_reader :title # deprecating title in favor of name
  attr_reader :name
  attr_reader :classes

  renders_one :tools
  renders_one :body
  renders_one :bare_content
  renders_one :footer_tools
  renders_one :footer

  def initialize(name: nil, description: nil, body_classes: nil, data: {}, display_breadcrumbs: false, index: nil, classes: nil, **args)
    # deprecating title in favor of name
    @title = args[:title]
    @name = name || title
    @description = description
    @classes = classes
    @body_classes = body_classes
    @data = data
    @display_breadcrumbs = display_breadcrumbs
    @index = index
  end

  private

  def white_panel_classes
    "bg-white rounded shadow"
  end

  def data_attributes
    @data.merge({"panel-index": @index})
  end

  def display_breadcrumbs?
    @display_breadcrumbs == true && Avo.configuration.display_breadcrumbs == true
  end

  def description
    return @description if @description.present?

    ""
  end

  def render_header?
    @name.present? || description.present? || tools.present? || display_breadcrumbs?
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
avo-2.16.1.pre.1.nativefields app/components/avo/panel_component.rb
avo-2.16.0 app/components/avo/panel_component.rb
avo-2.15.3 app/components/avo/panel_component.rb
avo-2.15.3.pre.1.data.attrs.to.sidebar.items app/components/avo/panel_component.rb
avo-2.15.2 app/components/avo/panel_component.rb
avo-2.15.2.pre.1 app/components/avo/panel_component.rb
avo-2.15.1 app/components/avo/panel_component.rb
avo-2.15.0 app/components/avo/panel_component.rb
avo-2.14.3.pre.7.polytranslations1 app/components/avo/panel_component.rb
avo-2.14.3.pre.6.nosprockets app/components/avo/panel_component.rb
avo-2.14.3.pre.5.nosprockets app/components/avo/panel_component.rb
avo-2.14.3.pre.4.tosqlfix app/components/avo/panel_component.rb
avo-2.14.3.pre.3.jsbundling app/components/avo/panel_component.rb
avo-2.14.3.pre.2.tailwindcss app/components/avo/panel_component.rb
avo-2.14.3.pre.1.branding app/components/avo/panel_component.rb
avo-2.14.2 app/components/avo/panel_component.rb
avo-2.14.2.pre.1 app/components/avo/panel_component.rb
avo-2.14.1 app/components/avo/panel_component.rb
avo-2.14.1.pre.1 app/components/avo/panel_component.rb
avo-2.14.0 app/components/avo/panel_component.rb