Class: Components::Card

Inherits:
Base
  • Object
show all
Includes:
Phlex::Rails::Helpers::LinkTo
Defined in:
app/components/card.rb

Instance Method Summary collapse

Constructor Details

#initialize(title:, variant:) ⇒ Card

Returns a new instance of Card.



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

def initialize(title:, variant:)
  @title = title
  @variant = variant
end

Instance Method Details

#view_template ⇒ Object



13
14
15
16
17
18
19
20
# File 'app/components/card.rb', line 13

def view_template
  div class: "card mb-4" do
    div(class: "card-header text-white bg-#{@variant}") { @title }
    div(class: "card-body") do
      yield
    end
  end
end