Class: RubyUIAdmin::Views::CardComponent

Inherits:
Phlex::HTML
  • Object
show all
Includes:
UI
Defined in:
app/components/ruby_ui_admin/views/card_component.rb

Overview

Renders a single dashboard card, dispatching on the card type.

Instance Method Summary collapse

Constructor Details

#initialize(card:) ⇒ CardComponent

Returns a new instance of CardComponent.



9
10
11
# File 'app/components/ruby_ui_admin/views/card_component.rb', line 9

def initialize(card:)
  @card = card
end

Instance Method Details

#view_templateObject



13
14
15
16
17
18
19
20
21
22
# File 'app/components/ruby_ui_admin/views/card_component.rb', line 13

def view_template
  render RubyUI::Card.new(class: span_class) do
    render RubyUI::CardHeader.new do
      render RubyUI::CardTitle.new(class: "text-sm font-medium text-muted-foreground") { @card.label }
    end
    render RubyUI::CardContent.new do
      render_body
    end
  end
end