Class: Ariadne::PanelBarComponent::PanelItem
- Inherits:
-
Component
- Object
- ViewComponent::Base
- Component
- Ariadne::PanelBarComponent::PanelItem
- 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
Constants included from ViewHelper
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::INTEGER_TYPES, FetchOrFallbackHelper::InvalidValueError, FetchOrFallbackHelper::TRUE_OR_FALSE
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#classes ⇒ Object
readonly
Returns the value of attribute classes.
-
#link ⇒ Object
readonly
Returns the value of attribute link.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(link: {}, classes: "", attributes: {}) ⇒ PanelItem
constructor
A new instance of PanelItem.
- #linked? ⇒ Boolean
- #selected? ⇒ Boolean
Methods included from ActionViewExtensions::FormHelper
Methods included from ClassNameHelper
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
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
55 56 57 |
# File 'app/components/ariadne/panel_bar_component.rb', line 55 def attributes @attributes end |
#classes ⇒ Object (readonly)
Returns the value of attribute classes.
55 56 57 |
# File 'app/components/ariadne/panel_bar_component.rb', line 55 def classes @classes end |
#link ⇒ Object (readonly)
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
#call ⇒ Object
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
70 71 72 |
# File 'app/components/ariadne/panel_bar_component.rb', line 70 def linked? @link.present? end |
#selected? ⇒ Boolean
66 67 68 |
# File 'app/components/ariadne/panel_bar_component.rb', line 66 def selected? @selected end |