Class: Railsboot::Navbar::BrandComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/railsboot/navbar/brand_component.rb

Overview

ViewComponent: renders the brand block.

Instance Method Summary collapse

Constructor Details

#initialize(tag: "a", **html_attributes) ⇒ BrandComponent

Returns a new instance of BrandComponent.



4
5
6
7
8
9
10
11
12
13
# File 'app/components/railsboot/navbar/brand_component.rb', line 4

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

#callObject



15
16
17
# File 'app/components/railsboot/navbar/brand_component.rb', line 15

def call
  render(Railsboot::BaseComponent.new(**@html_attributes)) { content }
end