Class: JetUi::Badge::Component

Inherits:
JetUi::BaseComponent show all
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

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, **options)
  @variant = VARIANTS.include?(variant) ? variant : DEFAULT_VARIANT
  @size    = SIZES.include?(size) ? size : DEFAULT_SIZE
  @rounded = rounded
  @options = options
end

Instance Method Details

#callObject



18
19
20
# File 'app/components/jet_ui/badge/component.rb', line 18

def call
   :span, content, class: classes, **@options
end