Class: DsfrComponent::BadgeComponent
- Defined in:
- app/components/dsfr_component/badge_component.rb
Constant Summary collapse
- STATUSES =
i[success error info warning new].freeze
Constants inherited from Base
DsfrComponent::Base::HEADING_LEVELS, DsfrComponent::Base::SIZES
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(status:, html_attributes: {}) ⇒ BadgeComponent
constructor
A new instance of BadgeComponent.
Constructor Details
#initialize(status:, html_attributes: {}) ⇒ BadgeComponent
Returns a new instance of BadgeComponent.
6 7 8 9 10 11 12 |
# File 'app/components/dsfr_component/badge_component.rb', line 6 def initialize(status:, html_attributes: {}) raise(ArgumentError, "`status` should be one of #{STATUSES}") unless STATUSES.include?(status) @status = status super(html_attributes: html_attributes) end |
Instance Method Details
#call ⇒ Object
14 15 16 17 18 |
# File 'app/components/dsfr_component/badge_component.rb', line 14 def call tag.div(**html_attributes) do content end end |