Class: Ariadne::UI::Heroicon::Component
- Inherits:
-
BaseComponent
- Object
- ViewComponentContrib::Base
- BaseComponent
- Ariadne::UI::Heroicon::Component
- Includes:
- IconHelper, HeroiconsHelper
- Defined in:
- app/components/ariadne/ui/heroicon/component.rb
Overview
Use this component whenever you need to render a [Heroicon](heroicons.com/) SVG icon.
Constant Summary collapse
- DEFAULT_SIZE =
:md
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::INTEGER_TYPES, FetchOrFallbackHelper::InvalidValueError, FetchOrFallbackHelper::TRUE_OR_FALSE
Constants inherited from BaseComponent
BaseComponent::ACCEPT_ANYTHING
Constants included from ViewHelper
Constants included from AttributesHelper
AttributesHelper::PLURAL_ARIA_ATTRIBUTES, AttributesHelper::PLURAL_DATA_ATTRIBUTES
Instance Method Summary collapse
-
#initialize(**options) ⇒ Component
constructor
A new instance of Component.
- #inner ⇒ Object
- #svg_attributes ⇒ Object
Methods included from IconHelper
#check_icon_presence!, ensure_valid_variant, #has_partial_icon?, #icon_presence!, #variant_presence!
Methods included from FetchOrFallbackHelper
#check_incoming_attribute, #check_incoming_tag, #check_incoming_value, #fetch_or_fallback, #fetch_or_raise, #fetch_or_raise_boolean, #fetch_or_raise_integer
Methods included from LoggerHelper
#logger, #silence_deprecations?, #silence_warnings?
Methods inherited from BaseComponent
audited_at, #class_for, #component, component_id, #component_id, component_name, generate_id, #html_attributes, i18n_scope, #merge_data_attributes, #merge_tailwind_classes, #options, stimulus_name, translate, #validate_aria_label!
Methods included from AttributesHelper
#aria, #data, #merge_aria, #merge_data, #merge_prefixed_attribute_hashes, #prepend_action, #prepend_controller, #prepend_data_attribute
Methods included from ViewComponent::StyleVariants
Constructor Details
#initialize(**options) ⇒ Component
Returns a new instance of Component.
41 42 43 44 45 46 47 |
# File 'app/components/ariadne/ui/heroicon/component.rb', line 41 def initialize(**) super check_icon_presence!(icon, variant) @heroicon = heroicon(@icon, variant: @variant) end |
Instance Method Details
#inner ⇒ Object
53 54 55 |
# File 'app/components/ariadne/ui/heroicon/component.rb', line 53 def inner ActiveSupport::SafeBuffer.new(@heroicon.inner) end |
#svg_attributes ⇒ Object
49 50 51 |
# File 'app/components/ariadne/ui/heroicon/component.rb', line 49 def svg_attributes tag.attributes(html_attrs.except(:class).merge(@heroicon.attributes.except("class", "aria-hidden"))) end |