Class: KozenetUi::HeaderComponent::ActionButtonComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- KozenetUi::HeaderComponent::ActionButtonComponent
- Defined in:
- app/components/kozenet_ui/header_component/action_button_component.rb
Overview
ActionButton section for the HeaderComponent Renders an action button (icon or text) in the header
"/cart", icon: :shopping_cart, label: "Cart") %>
Constant Summary collapse
- PLACEMENTS =
%i[start end].freeze
- PLACEMENT_ALIASES =
{ before: :start, left: :start, right: :end, after: :end }.freeze
- VISIBILITIES =
%i[always desktop mobile].freeze
- VISIBILITY_ALIASES =
{ all: :always, both: :always }.freeze
Constants inherited from BaseComponent
Instance Attribute Summary collapse
-
#placement ⇒ Object
readonly
Returns the value of attribute placement.
-
#visible_on ⇒ Object
readonly
Returns the value of attribute visible_on.
Attributes inherited from BaseComponent
#html_options, #size, #variant
Instance Method Summary collapse
-
#initialize(href: "#", icon: nil, text: nil, label: nil, placement: :end, position: nil, visible_on: :desktop, **html_options) ⇒ ActionButtonComponent
constructor
A new instance of ActionButtonComponent.
Constructor Details
#initialize(href: "#", icon: nil, text: nil, label: nil, placement: :end, position: nil, visible_on: :desktop, **html_options) ⇒ ActionButtonComponent
Returns a new instance of ActionButtonComponent.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/components/kozenet_ui/header_component/action_button_component.rb', line 27 def initialize( href: "#", icon: nil, text: nil, label: nil, placement: :end, position: nil, visible_on: :desktop, ** ) super(**) @href = href @icon = icon @text = text @label = label @placement = normalize_placement(position || placement) @visible_on = normalize_visibility(visible_on) end |
Instance Attribute Details
#placement ⇒ Object (readonly)
Returns the value of attribute placement.
25 26 27 |
# File 'app/components/kozenet_ui/header_component/action_button_component.rb', line 25 def placement @placement end |
#visible_on ⇒ Object (readonly)
Returns the value of attribute visible_on.
25 26 27 |
# File 'app/components/kozenet_ui/header_component/action_button_component.rb', line 25 def visible_on @visible_on end |