Class: Snazzy::PillComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Snazzy::PillComponent
- Defined in:
- app/components/snazzy/pill_component.rb
Instance Method Summary collapse
- #extra_classes(color, size, hoverable) ⇒ Object
-
#initialize(text, color: nil, hoverable: false, size: nil, iff: true) ⇒ PillComponent
constructor
A new instance of PillComponent.
Constructor Details
#initialize(text, color: nil, hoverable: false, size: nil, iff: true) ⇒ PillComponent
Returns a new instance of PillComponent.
5 6 7 8 9 |
# File 'app/components/snazzy/pill_component.rb', line 5 def initialize(text, color: nil, hoverable: false, size: nil, iff: true) @text = text @extra_classes = extra_classes(color, size, hoverable) @iff = iff end |
Instance Method Details
#extra_classes(color, size, hoverable) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'app/components/snazzy/pill_component.rb', line 11 def extra_classes(color, size, hoverable) extra_classes = [] extra_classes << color if color extra_classes << "--#{size}" if size extra_classes << "--hoverable" if hoverable extra_classes.join(" ") end |