Class: Irelia::Button::Component
- Includes:
- Options::Width
- Defined in:
- app/components/irelia/button/component.rb
Direct Known Subclasses
Dropdown::Component::DropdownItem, Dropdown::Component::DropdownTrigger, Modal::Component::ToggleButton, Navigation::Component::NavigationLink
Instance Method Summary collapse
-
#initialize(**options) ⇒ Component
constructor
A new instance of Component.
- #variants ⇒ Object
Methods included from Options::Width
Methods inherited from Component
#add_css_classes, after_initialize, #html_options, inherited, run_after_initialize_hooks
Constructor Details
#initialize(**options) ⇒ Component
Returns a new instance of Component.
32 33 34 35 36 37 38 39 |
# File 'app/components/irelia/button/component.rb', line 32 def initialize(**) super @tag = @url.present? ? :a : :button @html_options[:href] = @url if @url.present? @html_options[:type] = @type @html_options["data-turbo-frame"] = @modal if @modal.present? end |
Instance Method Details
#variants ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/components/irelia/button/component.rb', line 16 def variants class_names( "irelia-button", "irelia-button--default": variant == :default, "irelia-button--dropdown-item": variant == :dropdown_item, "irelia-button--color-primary": color == :primary, "irelia-button--color-secondary": color == :secondary, "irelia-button--color-danger": color == :danger, "irelia-button--xs": size == :xs, "irelia-button--sm": size == :sm, "irelia-button--md": size == :md, "irelia-button--lg": size == :lg, "irelia-button--xl": size == :xl ) end |