Class: Solidstats::Previews::StatusBadgeComponentPreview

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

Overview

Preview for StatusBadgeComponent

Instance Method Summary collapse

Instance Method Details

#defaultObject

Default status badge



8
9
10
# File 'app/components/solidstats/previews/status_badge_component_preview.rb', line 8

def default
  render(Solidstats::Ui::StatusBadgeComponent.new(status: :ok, text: "All Good"))
end

#sizesObject

Different sizes



26
27
28
29
30
31
32
33
34
# File 'app/components/solidstats/previews/status_badge_component_preview.rb', line 26

def sizes
  render_with_template(locals: {
    sizes: [
      { size: :small, status: :ok, text: "Small" },
      { size: :medium, status: :warning, text: "Medium" },
      { size: :large, status: :error, text: "Large" }
    ]
  })
end

#statusesObject

Different status variants



13
14
15
16
17
18
19
20
21
22
23
# File 'app/components/solidstats/previews/status_badge_component_preview.rb', line 13

def statuses
  render_with_template(locals: {
    statuses: [
      { status: :ok, text: "Secure" },
      { status: :warning, text: "Minor Issues" },
      { status: :error, text: "Vulnerabilities Found" },
      { status: :info, text: "Info Available" },
      { status: :critical, text: "Critical Issues" }
    ]
  })
end

#with_iconsObject

With icons



37
38
39
40
41
42
43
44
45
46
# File 'app/components/solidstats/previews/status_badge_component_preview.rb', line 37

def with_icons
  render_with_template(locals: {
    badges: [
      { status: :ok, text: "Secure", icon: "✓" },
      { status: :warning, text: "Warning", icon: "⚠" },
      { status: :error, text: "Error", icon: "✗" },
      { status: :info, text: "Info", icon: "ℹ" }
    ]
  })
end