Class: Ariadne::AvatarStackComponent
- Defined in:
- app/components/ariadne/avatar_stack_component.rb
Overview
Use AvatarStack to stack multiple avatars together.
Constant Summary collapse
- ALIGN_DEFAULT =
:left- ALIGN_OPTIONS =
[ALIGN_DEFAULT, :right].freeze
- DEFAULT_TAG =
:div- TAG_OPTIONS =
[DEFAULT_TAG, :span].freeze
- DEFAULT_BODY_TAG =
:div- BODY_TAG_OPTIONS =
[DEFAULT_BODY_TAG, :span].freeze
- DEFAULT_CLASSES =
"ariadne-flex ariadne--space-x-2 ariadne-overflow-hidden"
Constants inherited from Component
Component::BASE_HIDDEN_CLASS, Component::BASE_MAIN_CLASSES, Component::BASE_WRAPPER_CLASSES, Component::INVALID_ARIA_LABEL_TAGS
Constants included from Ariadne::ActionViewExtensions::FormHelper
Ariadne::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 Method Summary collapse
-
#initialize(tag: DEFAULT_TAG, align: ALIGN_DEFAULT, classes: "", attributes: {}) ⇒ AvatarStackComponent
constructor
A new instance of AvatarStackComponent.
- #render? ⇒ Boolean
- #tooltipped? ⇒ Boolean
Methods included from Ariadne::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(tag: DEFAULT_TAG, align: ALIGN_DEFAULT, classes: "", attributes: {}) ⇒ AvatarStackComponent
Returns a new instance of AvatarStackComponent.
54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'app/components/ariadne/avatar_stack_component.rb', line 54 def initialize(tag: DEFAULT_TAG, align: ALIGN_DEFAULT, classes: "", attributes: {}) @tag = check_incoming_tag(DEFAULT_TAG, tag) @align = fetch_or_raise(ALIGN_OPTIONS, align) @classes = class_names( DEFAULT_CLASSES, classes, ) @attributes = attributes @attributes[:id] ||= "avatar-stack-#{SecureRandom.hex(4)}" @id = @attributes[:id] end |
Instance Method Details
#render? ⇒ Boolean
67 68 69 |
# File 'app/components/ariadne/avatar_stack_component.rb', line 67 def render? avatars.any? end |
#tooltipped? ⇒ Boolean
71 72 73 |
# File 'app/components/ariadne/avatar_stack_component.rb', line 71 def tooltipped? tooltip.present? end |