Class: Keystone::Ui::ChartCardComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Keystone::Ui::ChartCardComponent
- Defined in:
- app/components/keystone/ui/chart_card_component.rb
Constant Summary collapse
- CARD_CLASSES =
"rounded-xl border border-gray-200 bg-white p-6 dark:border-zinc-700 dark:bg-zinc-800"- TITLE_CLASSES =
"text-sm font-medium text-gray-500 dark:text-gray-400 mb-4"- HEIGHT_CLASSES =
{ sm: "h-48", md: "h-64", lg: "h-96" }.freeze
Instance Attribute Summary collapse
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #chart_height_class ⇒ Object
- #classes ⇒ Object
-
#initialize(title:, height: :md) ⇒ ChartCardComponent
constructor
A new instance of ChartCardComponent.
- #title_classes ⇒ Object
Constructor Details
#initialize(title:, height: :md) ⇒ ChartCardComponent
Returns a new instance of ChartCardComponent.
17 18 19 20 |
# File 'app/components/keystone/ui/chart_card_component.rb', line 17 def initialize(title:, height: :md) @title = title @height = height end |
Instance Attribute Details
#title ⇒ Object (readonly)
Returns the value of attribute title.
15 16 17 |
# File 'app/components/keystone/ui/chart_card_component.rb', line 15 def title @title end |
Instance Method Details
#chart_height_class ⇒ Object
30 31 32 |
# File 'app/components/keystone/ui/chart_card_component.rb', line 30 def chart_height_class HEIGHT_CLASSES.fetch(@height) end |
#classes ⇒ Object
22 23 24 |
# File 'app/components/keystone/ui/chart_card_component.rb', line 22 def classes CARD_CLASSES end |
#title_classes ⇒ Object
26 27 28 |
# File 'app/components/keystone/ui/chart_card_component.rb', line 26 def title_classes TITLE_CLASSES end |