Class: Brainzlab::Components::StatCard
- Defined in:
- lib/brainzlab/components/stat_card.rb
Instance Method Summary collapse
-
#initialize(label:, value:, change: nil, change_type: nil, **attrs) ⇒ StatCard
constructor
A new instance of StatCard.
- #view_template ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(label:, value:, change: nil, change_type: nil, **attrs) ⇒ StatCard
Returns a new instance of StatCard.
6 7 8 9 10 11 12 |
# File 'lib/brainzlab/components/stat_card.rb', line 6 def initialize(label:, value:, change: nil, change_type: nil, **attrs) @label = label @value = value @change = change @change_type = change_type @attrs = attrs end |
Instance Method Details
#view_template ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/brainzlab/components/stat_card.rb', line 14 def view_template div(class: classes('stat-card', @attrs[:class]), **@attrs.except(:class)) do div(class: 'stat-label') { @label } div(class: 'stat-value') { @value } span(class: change_classes) { @change } if @change end end |