Class: Ariadne::CloseButtonComponent
- Defined in:
- app/components/ariadne/close_button_component.rb
Overview
Simple button with X icon to close models and such
Constant Summary collapse
- DEFAULT_TAG =
:button- TAG_OPTIONS =
[DEFAULT_TAG].freeze
- DEFAULT_CLASSES =
"ariadne-border-none ariadne-bg-transparent ariadne-shadow-none hover:ariadne-bg-transparent"
Constants inherited from Component
Ariadne::Component::BASE_HIDDEN_CLASS, Ariadne::Component::BASE_MAIN_CLASSES, Ariadne::Component::BASE_WRAPPER_CLASSES, Ariadne::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 Method Summary collapse
-
#initialize(tag: DEFAULT_TAG, classes: "", icon_classes: "", size: :xs, aria_label: nil, scheme: :none, attributes: {}) ⇒ CloseButtonComponent
constructor
A new instance of CloseButtonComponent.
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(tag: DEFAULT_TAG, classes: "", icon_classes: "", size: :xs, aria_label: nil, scheme: :none, attributes: {}) ⇒ CloseButtonComponent
Returns a new instance of CloseButtonComponent.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/components/ariadne/close_button_component.rb', line 18 def initialize(tag: DEFAULT_TAG, classes: "", icon_classes: "", size: :xs, aria_label: nil, scheme: :none, attributes: {}) raise ArgumentError, "An 'aria_label' argument is required to use a Close Button. Include as much detail as you can about what the button will be closing." if aria_label.blank? @tag = check_incoming_tag(DEFAULT_TAG, tag) @attributes = { "aria-label": aria_label }.merge(attributes) @classes = merge_class_names( DEFAULT_CLASSES, classes, ) @scheme = scheme @size = size @icon_classses = icon_classes end |