Class: Keystone::Ui::ChartCardComponent

Inherits:
ViewComponent::Base
  • Object
show all
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

Instance Method Summary collapse

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

#titleObject (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_classObject



30
31
32
# File 'app/components/keystone/ui/chart_card_component.rb', line 30

def chart_height_class
  HEIGHT_CLASSES.fetch(@height)
end

#classesObject



22
23
24
# File 'app/components/keystone/ui/chart_card_component.rb', line 22

def classes
  CARD_CLASSES
end

#title_classesObject



26
27
28
# File 'app/components/keystone/ui/chart_card_component.rb', line 26

def title_classes
  TITLE_CLASSES
end