Class: SnFilterable::BaseComponents::BaseComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- SnFilterable::BaseComponents::BaseComponent
- Includes:
- ClassNameHelper, FetchOrFallbackHelper
- Defined in:
- app/components/sn_filterable/base_components/base_component.rb
Direct Known Subclasses
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(tag:, classes: nil, **system_arguments) ⇒ BaseComponent
constructor
A new instance of BaseComponent.
Constructor Details
#initialize(tag:, classes: nil, **system_arguments) ⇒ BaseComponent
Returns a new instance of BaseComponent.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/components/sn_filterable/base_components/base_component.rb', line 9 def initialize(tag:, classes: nil, **system_arguments) @tag = tag @system_arguments = system_arguments # TODO # Implement a more native way of adding custom CSS class instead of stupid string concat # Similar to the Claasifier Primer build # https://github.com/primer/view_components/blob/41b277aa047ba7d1a669a48dc392115bf4948435/app/components/primer/base_component.rb @system_arguments[:class] = class_names( system_arguments[:class], classes ) end |
Instance Method Details
#call ⇒ Object
23 24 25 |
# File 'app/components/sn_filterable/base_components/base_component.rb', line 23 def call content_tag(@tag, content, **@system_arguments) end |