Class: Spotlight::TitleComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/spotlight/title_component.rb

Overview

Draws the title in the masthead

Instance Method Summary collapse

Constructor Details

#initialize(title:, subtitle:) ⇒ TitleComponent

Returns a new instance of TitleComponent.



6
7
8
9
10
# File 'app/components/spotlight/title_component.rb', line 6

def initialize(title:, subtitle:)
  @title = title
  @subtitle = subtitle
  super
end

Instance Method Details

#subtitleObject



16
17
18
19
20
# File 'app/components/spotlight/title_component.rb', line 16

def subtitle
  return unless @subtitle

  tag.small(@subtitle, class: 'd-none d-md-block py-2 fs-4')
end

#titleObject



12
13
14
# File 'app/components/spotlight/title_component.rb', line 12

def title
  tag.h1 @title, class: 'site-title h2'
end