Class: Solidstats::Previews::StatsOverviewComponentPreview
- Inherits:
-
ViewComponent::Preview
- Object
- ViewComponent::Preview
- Solidstats::Previews::StatsOverviewComponentPreview
- Defined in:
- app/components/solidstats/previews/stats_overview_component_preview.rb
Overview
Preview for StatsOverviewComponent
Instance Method Summary collapse
-
#clickable_metrics ⇒ Object
Clickable metrics.
-
#default ⇒ Object
Default metrics overview.
-
#different_statuses ⇒ Object
Metrics with different statuses.
-
#value_formats ⇒ Object
Various value formats.
Instance Method Details
#clickable_metrics ⇒ Object
Clickable metrics
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/components/solidstats/previews/stats_overview_component_preview.rb', line 27 def clickable_metrics metrics = [ { label: "Security Issues", value: 3, icon: "๐", section: "security", tab: "vulnerabilities" }, { label: "TODO Items", value: 15, icon: "๐", section: "tasks", href: "#tasks" } ] render(Solidstats::Ui::StatsOverviewComponent.new(metrics: metrics)) end |
#default ⇒ Object
Default metrics overview
8 9 10 11 12 |
# File 'app/components/solidstats/previews/stats_overview_component_preview.rb', line 8 def default render(Solidstats::Ui::StatsOverviewComponent.new( metrics: sample_metrics )) end |
#different_statuses ⇒ Object
Metrics with different statuses
15 16 17 18 19 20 21 22 23 24 |
# File 'app/components/solidstats/previews/stats_overview_component_preview.rb', line 15 def different_statuses metrics = [ { label: "Secure Gems", value: 95, icon: "๐", status: :ok }, { label: "Vulnerabilities", value: 3, icon: "โ ๏ธ", status: :warning }, { label: "Critical Issues", value: 1, icon: "๐จ", status: :error }, { label: "Outdated Gems", value: 12, icon: "๐ ", status: :info } ] render(Solidstats::Ui::StatsOverviewComponent.new(metrics: metrics)) end |
#value_formats ⇒ Object
Various value formats
49 50 51 52 53 54 55 56 57 58 |
# File 'app/components/solidstats/previews/stats_overview_component_preview.rb', line 49 def value_formats metrics = [ { label: "Test Coverage", value: "94%", icon: "๐งช", status: :ok }, { label: "Build Time", value: "2.3s", icon: "โฑ๏ธ", status: :ok }, { label: "Bundle Size", value: "1.2MB", icon: "๐ฆ", status: :warning }, { label: "Dependencies", value: 127, icon: "๐", status: :info } ] render(Solidstats::Ui::StatsOverviewComponent.new(metrics: metrics)) end |