Class: Panda::Core::Admin::ButtonComponent
- Defined in:
- app/components/panda/core/admin/button_component.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#as_button ⇒ Object
readonly
Returns the value of attribute as_button.
-
#href ⇒ Object
readonly
Returns the value of attribute href.
-
#icon ⇒ Object
readonly
Returns the value of attribute icon.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
- #default_attrs ⇒ Object
-
#initialize(text: "Button", action: nil, href: "#", icon: nil, size: :regular, id: nil, as_button: false, **attrs) ⇒ ButtonComponent
constructor
A new instance of ButtonComponent.
Constructor Details
#initialize(text: "Button", action: nil, href: "#", icon: nil, size: :regular, id: nil, as_button: false, **attrs) ⇒ ButtonComponent
Returns a new instance of ButtonComponent.
7 8 9 10 11 12 13 14 15 16 |
# File 'app/components/panda/core/admin/button_component.rb', line 7 def initialize(text: "Button", action: nil, href: "#", icon: nil, size: :regular, id: nil, as_button: false, **attrs) @text = text @action = action @href = href @icon = icon @size = size @id = id @as_button = super(**attrs) end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
18 19 20 |
# File 'app/components/panda/core/admin/button_component.rb', line 18 def action @action end |
#as_button ⇒ Object (readonly)
Returns the value of attribute as_button.
18 19 20 |
# File 'app/components/panda/core/admin/button_component.rb', line 18 def @as_button end |
#href ⇒ Object (readonly)
Returns the value of attribute href.
18 19 20 |
# File 'app/components/panda/core/admin/button_component.rb', line 18 def href @href end |
#icon ⇒ Object (readonly)
Returns the value of attribute icon.
18 19 20 |
# File 'app/components/panda/core/admin/button_component.rb', line 18 def icon @icon end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
18 19 20 |
# File 'app/components/panda/core/admin/button_component.rb', line 18 def id @id end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
18 19 20 |
# File 'app/components/panda/core/admin/button_component.rb', line 18 def size @size end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
18 19 20 |
# File 'app/components/panda/core/admin/button_component.rb', line 18 def text @text end |
Instance Method Details
#default_attrs ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/components/panda/core/admin/button_component.rb', line 20 def default_attrs base = { class: , id: @id } if @as_button base.merge(type: "button") else base.merge(href: @href) end end |