Class: Flowbite::Card::Title

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/flowbite/card/title.rb

Overview

Renders the title of a card element.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**options) ⇒ Title

Returns a new instance of Title.



34
35
36
# File 'app/components/flowbite/card/title.rb', line 34

def initialize(**options)
  @options = options || {}
end

Class Method Details

.classes(state: :default, style: :default) ⇒ Object



8
9
10
11
# File 'app/components/flowbite/card/title.rb', line 8

def classes(state: :default, style: :default)
  style = styles.fetch(style)
  style.fetch(state)
end

.stylesObject

rubocop:disable Layout/LineLength



14
15
16
17
18
19
20
21
22
# File 'app/components/flowbite/card/title.rb', line 14

def styles
  Flowbite::Styles.from_hash(
    {
      default: {
        default: ["mb-2", "text-2xl", "font-semibold", "tracking-tight", "text-heading"]
      }
    }.freeze
  )
end

Instance Method Details

#callObject



26
27
28
29
30
31
32
# File 'app/components/flowbite/card/title.rb', line 26

def call
  title_options = {
    class: self.class.classes
  }.merge(@options)

  (:h5, content, **title_options)
end