Class: Railsboot::NavbarComponent
- Inherits:
-
Component
- Object
- Component
- Railsboot::NavbarComponent
- Defined in:
- app/components/railsboot/navbar_component.rb
Overview
ViewComponent: renders the navbar block.
Constant Summary collapse
- EXPANDS =
Expands.
%w[sm md lg xl xxl].freeze
- DEFAULT_EXPAND =
Default expand.
"".freeze
Instance Method Summary collapse
-
#initialize(expand: DEFAULT_EXPAND, **html_attributes) ⇒ NavbarComponent
constructor
A new instance of NavbarComponent.
Constructor Details
#initialize(expand: DEFAULT_EXPAND, **html_attributes) ⇒ NavbarComponent
Returns a new instance of NavbarComponent.
9 10 11 12 13 14 15 16 17 18 |
# File 'app/components/railsboot/navbar_component.rb', line 9 def initialize(expand: DEFAULT_EXPAND, **html_attributes) @expand = fetch_or_fallback(, EXPANDS, DEFAULT_EXPAND) @html_attributes = html_attributes @html_attributes[:class] = class_names( "navbar", { "navbar-expand-#{@expand}" => @expand.present? }, html_attributes.delete(:class) ) end |