Class: Maquina::Dashboard::Stats

Inherits:
Phlex::HTML
  • Object
show all
Includes:
Phlex::Rails::Helpers::Translate
Defined in:
app/views/maquina/dashboard/stats.rb

Instance Method Summary collapse

Constructor Details

#initialize(stats:) ⇒ Stats

Returns a new instance of Stats.



6
7
8
# File 'app/views/maquina/dashboard/stats.rb', line 6

def initialize(stats:)
  @stats = stats
end

Instance Method Details

#view_templateObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/views/maquina/dashboard/stats.rb', line 10

def view_template
  div(class: "mx-auto max-w-lg") do
    h3(class: "text-base font-semibold text-skin-base") { t("maquina.dashboard.index.stats.title") }

    dl(class: "mt-5 grid grid-cols-2 gap-5 sm:grid-cols-#{@stats.length}") do
      @stats.each do |stat|
        stats_card(
          label: stat[:label],
          value: stat[:value]
        )
      end
    end
  end
end