Class: ElementComponent::Components::Navbar
- Defined in:
- lib/element_component/components/navbar.rb
Constant Summary collapse
- VALID_EXPAND =
%i[sm md lg xl xxl].freeze
- VALID_THEMES =
%i[light dark].freeze
- VALID_FIXED =
%i[top bottom].freeze
- VALID_STICKY =
%i[top bottom].freeze
Instance Attribute Summary
Attributes inherited from Element
#attributes, #contents, #element, #html
Instance Method Summary collapse
-
#initialize(expand: :lg, theme: :light, background: nil, fixed: nil, sticky: nil, container: true, **attributes, &block) ⇒ Navbar
constructor
A new instance of Navbar.
Methods inherited from Element
#add_attribute, #add_attribute!, #add_content, #add_content!, #new_element, #remove_attribute, #remove_attribute_value, #render, #reset_attributes!, #reset_contents!
Constructor Details
#initialize(expand: :lg, theme: :light, background: nil, fixed: nil, sticky: nil, container: true, **attributes, &block) ⇒ Navbar
Returns a new instance of Navbar.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/element_component/components/navbar.rb', line 16 def initialize(expand: :lg, theme: :light, background: nil, fixed: nil, sticky: nil, container: true, **attributes, &block) super("nav", &block) add_attribute(class: "navbar") add_attribute(class: "navbar-expand-#{}") add_attribute(class: "navbar-#{theme}") add_attribute(class: "bg-#{background}") if background add_attribute(class: "fixed-#{fixed}") if fixed add_attribute(class: "sticky-#{sticky}") if sticky add_attribute(attributes) unless attributes.empty? @use_container = container end |