Class: Pajamas::ButtonComponent
- Defined in:
- app/components/pajamas/button_component.rb
Instance Method Summary collapse
-
#initialize(category: :primary, variant: :default, size: :medium, type: :button, disabled: false, loading: false, block: false, selected: false, icon: nil, href: nil, target: nil, method: nil, button_options: {}, button_text_classes: nil, icon_classes: nil) ⇒ ButtonComponent
constructor
A new instance of ButtonComponent.
Constructor Details
#initialize(category: :primary, variant: :default, size: :medium, type: :button, disabled: false, loading: false, block: false, selected: false, icon: nil, href: nil, target: nil, method: nil, button_options: {}, button_text_classes: nil, icon_classes: nil) ⇒ ButtonComponent
Returns a new instance of ButtonComponent.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'app/components/pajamas/button_component.rb', line 20 def initialize( category: :primary, variant: :default, size: :medium, type: :button, disabled: false, loading: false, block: false, selected: false, icon: nil, href: nil, target: nil, method: nil, button_options: {}, button_text_classes: nil, icon_classes: nil ) @category = filter_attribute(category.to_sym, CATEGORY_OPTIONS) @variant = filter_attribute(variant.to_sym, VARIANT_OPTIONS) @size = filter_attribute(size.to_sym, SIZE_OPTIONS) @type = filter_attribute(type.to_sym, TYPE_OPTIONS, default: :button) @disabled = disabled @loading = loading @block = block @selected = selected @icon = icon @href = href @target = filter_attribute(target, TARGET_OPTIONS) @method = filter_attribute(method, METHOD_OPTIONS) @button_options = @button_text_classes = @icon_classes = icon_classes end |