Class: Keystone::Ui::FeatureGridComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/keystone/ui/feature_grid_component.rb

Constant Summary collapse

GRID_CLASSES =
"grid gap-6 sm:grid-cols-2 lg:grid-cols-3"
TITLE_BASE_CLASSES =
"mb-4 text-center text-3xl font-bold tracking-tight sm:text-4xl"
SUBTITLE_BASE_CLASSES =
"mx-auto mb-16 max-w-2xl text-center text-lg"
CARD_LAYOUT_CLASSES =
"rounded-xl border p-6 transition"
ICON_BASE_CLASSES =
"mb-4 flex size-10 items-center justify-center rounded-lg text-lg"
CARD_TITLE_BASE_CLASSES =
"mb-2 text-lg font-semibold"
CARD_DESCRIPTION_BASE_CLASSES =
"text-sm"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title:, features:, subtitle: nil) ⇒ FeatureGridComponent

Returns a new instance of FeatureGridComponent.



16
17
18
19
20
# File 'app/components/keystone/ui/feature_grid_component.rb', line 16

def initialize(title:, features:, subtitle: nil)
  @title = title
  @subtitle = subtitle
  @features = features
end

Instance Attribute Details

#featuresObject (readonly)

Returns the value of attribute features.



14
15
16
# File 'app/components/keystone/ui/feature_grid_component.rb', line 14

def features
  @features
end

#subtitleObject (readonly)

Returns the value of attribute subtitle.



14
15
16
# File 'app/components/keystone/ui/feature_grid_component.rb', line 14

def subtitle
  @subtitle
end

#titleObject (readonly)

Returns the value of attribute title.



14
15
16
# File 'app/components/keystone/ui/feature_grid_component.rb', line 14

def title
  @title
end

Instance Method Details

#card_classesObject



38
39
40
# File 'app/components/keystone/ui/feature_grid_component.rb', line 38

def card_classes
  "#{CARD_LAYOUT_CLASSES} border-surface-200 dark:border-surface-700 bg-white dark:bg-surface-800 hover:border-accent-500/50 dark:hover:border-accent-500/50"
end

#card_description_classesObject



50
51
52
# File 'app/components/keystone/ui/feature_grid_component.rb', line 50

def card_description_classes
  "#{CARD_DESCRIPTION_BASE_CLASSES} text-surface-500 dark:text-surface-400"
end

#card_title_classesObject



46
47
48
# File 'app/components/keystone/ui/feature_grid_component.rb', line 46

def card_title_classes
  "#{CARD_TITLE_BASE_CLASSES} text-surface-900 dark:text-white"
end

#classesObject



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

def classes
  GRID_CLASSES
end

#icon_classesObject



42
43
44
# File 'app/components/keystone/ui/feature_grid_component.rb', line 42

def icon_classes
  "#{ICON_BASE_CLASSES} bg-accent-500/10 text-accent-600 dark:text-accent-400"
end

#subtitle?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'app/components/keystone/ui/feature_grid_component.rb', line 34

def subtitle?
  !@subtitle.nil?
end

#subtitle_classesObject



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

def subtitle_classes
  "#{SUBTITLE_BASE_CLASSES} text-surface-500 dark:text-surface-400"
end

#title_classesObject



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

def title_classes
  "#{TITLE_BASE_CLASSES} text-surface-900 dark:text-white"
end