Class: StimulusPlumbers::Components::Icon
- Inherits:
-
Plumber::Base
- Object
- Plumber::Base
- StimulusPlumbers::Components::Icon
- Defined in:
- lib/stimulus_plumbers/components/icon.rb
Instance Attribute Summary
Attributes inherited from Plumber::Base
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Plumber::Base
Methods included from Plumber::Renderer
#set_slots, #slot_block_for, #slot_kwargs_for, #slot_renderable?
Methods included from Plumber::Options::Aria
Methods included from Plumber::Options::Html
Constructor Details
This class inherits a constructor from StimulusPlumbers::Plumber::Base
Class Method Details
.icon_name?(value) ⇒ Boolean
6 7 8 |
# File 'lib/stimulus_plumbers/components/icon.rb', line 6 def self.icon_name?(value) value.is_a?(Symbol) || (value.is_a?(String) && !value.html_safe?) end |
Instance Method Details
#render(name:, **kwargs) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/stimulus_plumbers/components/icon.rb', line 10 def render(name:, **kwargs) = ( theme.resolve(:icon), kwargs ) icon_data = Themes::Schema::Icon.resolve(theme.icons[name.to_s]) if icon_data svg_icon(icon_data, ) else template.tag.span(**) end end |