Class: Solidstats::Previews::SummaryCardComponentPreview
- Inherits:
-
ViewComponent::Preview
- Object
- ViewComponent::Preview
- Solidstats::Previews::SummaryCardComponentPreview
- Defined in:
- app/components/solidstats/previews/summary_card_component_preview.rb
Overview
Preview for SummaryCardComponent
Instance Method Summary collapse
-
#clickable ⇒ Object
Clickable cards.
-
#dashboard_layout ⇒ Object
Dashboard layout example.
-
#default ⇒ Object
Default summary card.
-
#statuses ⇒ Object
Different statuses.
-
#value_formats ⇒ Object
With different value formats.
Instance Method Details
#clickable ⇒ Object
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_layout ⇒ Object
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 |
#default ⇒ Object
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 |
#statuses ⇒ Object
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_formats ⇒ Object
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 |