Class: Solidstats::Previews::SummaryCardComponentPreview

Inherits:
ViewComponent::Preview
  • Object
show all
Defined in:
app/components/solidstats/previews/summary_card_component_preview.rb

Overview

Preview for SummaryCardComponent

Instance Method Summary collapse

Instance Method Details

#clickableObject

Clickable cards



30
31
32
33
34
35
36
37
38
# File 'app/components/solidstats/previews/summary_card_component_preview.rb', line 30

def clickable
  render_with_template(locals: {
    cards: [
      { title: "Security Issues", value: 3, status: :error, href: "/security", section: "security" },
      { title: "Code Quality", value: 85, status: :ok, href: "/quality", section: "quality" },
      { title: "Dependencies", value: 127, status: :warning, href: "/deps", section: "dependencies" }
    ]
  })
end

#dashboard_layoutObject

Dashboard layout example



53
54
55
56
57
58
59
60
61
62
63
64
# File 'app/components/solidstats/previews/summary_card_component_preview.rb', line 53

def dashboard_layout
  render_with_template(locals: {
    metrics: [
      { title: "Total Gems", value: 127, status: :ok, icon: "๐Ÿ’Ž" },
      { title: "Vulnerabilities", value: 0, status: :ok, icon: "๐Ÿ”’" },
      { title: "Outdated", value: 8, status: :warning, icon: "๐Ÿ“…" },
      { title: "Code Quality", value: "A+", status: :ok, icon: "โญ" },
      { title: "Test Coverage", value: "94%", status: :ok, icon: "๐Ÿงช" },
      { title: "Build Status", value: "Passing", status: :ok, icon: "โœ…" }
    ]
  })
end

#defaultObject

Default summary card



8
9
10
11
12
13
14
# File 'app/components/solidstats/previews/summary_card_component_preview.rb', line 8

def default
  render(Solidstats::Ui::SummaryCardComponent.new(
    title: "Total Gems",
    value: 127,
    status: :ok
  ))
end

#statusesObject

Different statuses



17
18
19
20
21
22
23
24
25
26
27
# File 'app/components/solidstats/previews/summary_card_component_preview.rb', line 17

def statuses
  render_with_template(locals: {
    cards: [
      { title: "Secure Gems", value: 95, status: :ok, icon: "๐Ÿ”’" },
      { title: "Minor Issues", value: 12, status: :warning, icon: "โš " },
      { title: "Vulnerabilities", value: 3, status: :error, icon: "๐Ÿšจ" },
      { title: "Outdated", value: 8, status: :info, icon: "๐Ÿ“…" },
      { title: "Critical Issues", value: 1, status: :critical, icon: "๐Ÿ’ฅ" }
    ]
  })
end

#value_formatsObject

With different value formats



41
42
43
44
45
46
47
48
49
50
# File 'app/components/solidstats/previews/summary_card_component_preview.rb', line 41

def value_formats
  render_with_template(locals: {
    cards: [
      { title: "Lines of Code", value: 15420, status: :info },
      { title: "Test Coverage", value: "92%", status: :ok },
      { title: "Build Time", value: "2.3s", status: :ok },
      { title: "Bundle Size", value: "1.2MB", status: :warning }
    ]
  })
end