Class: JetUi::Badge::Component
- Inherits:
-
JetUi::BaseComponent
- Object
- ViewComponent::Base
- JetUi::BaseComponent
- JetUi::Badge::Component
- Defined in:
- app/components/jet_ui/badge/component.rb
Constant Summary collapse
- VARIANTS =
%i[default info error success warning].freeze
- DEFAULT_VARIANT =
:default- SIZES =
%i[xs sm md lg].freeze
- DEFAULT_SIZE =
:sm
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(variant: DEFAULT_VARIANT, size: DEFAULT_SIZE, rounded: false, **options) ⇒ Component
constructor
A new instance of Component.
Constructor Details
#initialize(variant: DEFAULT_VARIANT, size: DEFAULT_SIZE, rounded: false, **options) ⇒ Component
Returns a new instance of Component.
11 12 13 14 15 16 |
# File 'app/components/jet_ui/badge/component.rb', line 11 def initialize(variant: DEFAULT_VARIANT, size: DEFAULT_SIZE, rounded: false, **) @variant = VARIANTS.include?(variant) ? variant : DEFAULT_VARIANT @size = SIZES.include?(size) ? size : DEFAULT_SIZE @rounded = rounded @options = end |
Instance Method Details
#call ⇒ Object
18 19 20 |
# File 'app/components/jet_ui/badge/component.rb', line 18 def call content_tag :span, content, class: classes, **@options end |