Class: Ariadne::PanelBarComponent::PanelItem

Inherits:
Component
  • Object
show all
Defined in:
app/components/ariadne/panel_bar_component.rb

Overview

This component is part of PanelBarComponent and should not be used as a standalone component.

Constant Summary collapse

DEFAULT_ITEM_CLASSES =
"ariadne-relative md:ariadne-flex-1 md:ariadne-flex"
DEFAULT_WRAPPER_CLASSES =
"group ariadne-flex ariadne-items-center ariadne-w-full"

Constants inherited from Component

Component::BASE_BODY_CLASSES, Component::BASE_HTML_CLASSES, Component::BASE_MAIN_CLASSES, Component::BASE_WRAPPER_CLASSES, Component::INVALID_ARIA_LABEL_TAGS

Constants included from ActionViewExtensions::FormHelper

ActionViewExtensions::FormHelper::DEFAULT_FORM_CLASSES

Constants included from Status::Dsl

Status::Dsl::STATUSES

Constants included from ViewHelper

ViewHelper::HELPERS

Constants included from FetchOrFallbackHelper

FetchOrFallbackHelper::INTEGER_TYPES, FetchOrFallbackHelper::InvalidValueError, FetchOrFallbackHelper::TRUE_OR_FALSE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ActionViewExtensions::FormHelper

#ariadne_form_with

Methods included from ClassNameHelper

#class_names

Methods included from LoggerHelper

#logger, #silence_deprecations?, #silence_warnings?

Methods included from FetchOrFallbackHelper

#check_incoming_attribute, #check_incoming_tag, #check_incoming_value, #fetch_or_raise, #fetch_or_raise_boolean, #fetch_or_raise_integer

Constructor Details

#initialize(link: {}, classes: "", attributes: {}) ⇒ PanelItem

Returns a new instance of PanelItem.



57
58
59
60
61
62
63
64
# File 'app/components/ariadne/panel_bar_component.rb', line 57

def initialize(link: {}, classes: "", attributes: {})
  @link = link
  if @link.present?
    @link["classes"] = class_names(DEFAULT_WRAPPER_CLASSES, @link["classes"])
  end
  @classes = class_names(DEFAULT_ITEM_CLASSES, classes)
  @attributes = attributes
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



55
56
57
# File 'app/components/ariadne/panel_bar_component.rb', line 55

def attributes
  @attributes
end

#classesObject (readonly)

Returns the value of attribute classes.



55
56
57
# File 'app/components/ariadne/panel_bar_component.rb', line 55

def classes
  @classes
end

Returns the value of attribute link.



55
56
57
# File 'app/components/ariadne/panel_bar_component.rb', line 55

def link
  @link
end

Instance Method Details

#callObject



74
75
76
# File 'app/components/ariadne/panel_bar_component.rb', line 74

def call
  render(Ariadne::BaseComponent.new(tag: :div, classes: @classes, attributes: @attributes))
end

#linked?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'app/components/ariadne/panel_bar_component.rb', line 70

def linked?
  @link.present?
end

#selected?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'app/components/ariadne/panel_bar_component.rb', line 66

def selected?
  @selected
end