Class: Railsboot::Navbar::BrandComponent
- Inherits:
-
Component
- Object
- Component
- Railsboot::Navbar::BrandComponent
- Defined in:
- app/components/railsboot/navbar/brand_component.rb
Overview
ViewComponent: renders the brand block.
Instance Method Summary collapse
-
#call ⇒ String
Renders the brand block as a BaseComponent with the configured tag and HTML attributes, wrapping the provided content.
-
#initialize(tag: "a", **html_attributes) ⇒ BrandComponent
constructor
A new instance of BrandComponent.
Constructor Details
#initialize(tag: "a", **html_attributes) ⇒ BrandComponent
Returns a new instance of BrandComponent.
8 9 10 11 12 13 14 15 16 17 |
# File 'app/components/railsboot/navbar/brand_component.rb', line 8 def initialize(tag: "a", **html_attributes) @tag = tag @html_attributes = html_attributes @html_attributes[:tag] = @tag @html_attributes[:class] = class_names( "navbar-brand", html_attributes.delete(:class) ) end |
Instance Method Details
#call ⇒ String
Renders the brand block as a BaseComponent with the
configured tag and HTML attributes, wrapping the provided content.
22 23 24 |
# File 'app/components/railsboot/navbar/brand_component.rb', line 22 def call render(Railsboot::BaseComponent.new(**@html_attributes)) { content } end |