Class: IronAdmin::Dashboards::StatsGridComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- IronAdmin::Dashboards::StatsGridComponent
- Defined in:
- app/components/iron_admin/dashboards/stats_grid_component.rb
Overview
Renders a grid of statistics cards.
Defined Under Namespace
Classes: StatComponent
Instance Attribute Summary collapse
-
#columns ⇒ Integer
readonly
Number of columns.
Instance Method Summary collapse
-
#grid_classes ⇒ String
private
Tailwind grid column classes based on columns count.
-
#initialize(columns: 4) ⇒ StatsGridComponent
constructor
A new instance of StatsGridComponent.
Constructor Details
#initialize(columns: 4) ⇒ StatsGridComponent
Returns a new instance of StatsGridComponent.
13 14 15 |
# File 'app/components/iron_admin/dashboards/stats_grid_component.rb', line 13 def initialize(columns: 4) @columns = columns end |
Instance Attribute Details
#columns ⇒ Integer (readonly)
Returns Number of columns.
10 11 12 |
# File 'app/components/iron_admin/dashboards/stats_grid_component.rb', line 10 def columns @columns end |
Instance Method Details
#grid_classes ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Tailwind grid column classes based on columns count.
19 20 21 22 23 24 25 26 |
# File 'app/components/iron_admin/dashboards/stats_grid_component.rb', line 19 def grid_classes case columns when 2 then "grid-cols-1 sm:grid-cols-2" when 3 then "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3" when 4 then "grid-cols-1 sm:grid-cols-2 lg:grid-cols-4" else "grid-cols-1 sm:grid-cols-2 lg:grid-cols-4" end end |