Class: Keystone::Ui::FeatureGridComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Keystone::Ui::FeatureGridComponent
- 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
-
#features ⇒ Object
readonly
Returns the value of attribute features.
-
#subtitle ⇒ Object
readonly
Returns the value of attribute subtitle.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #card_classes ⇒ Object
- #card_description_classes ⇒ Object
- #card_title_classes ⇒ Object
- #classes ⇒ Object
- #icon_classes ⇒ Object
-
#initialize(title:, features:, subtitle: nil) ⇒ FeatureGridComponent
constructor
A new instance of FeatureGridComponent.
- #subtitle? ⇒ Boolean
- #subtitle_classes ⇒ Object
- #title_classes ⇒ Object
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
#features ⇒ Object (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 |
#subtitle ⇒ Object (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 |
#title ⇒ Object (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_classes ⇒ Object
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_classes ⇒ Object
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_classes ⇒ Object
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 |
#classes ⇒ Object
22 23 24 |
# File 'app/components/keystone/ui/feature_grid_component.rb', line 22 def classes GRID_CLASSES end |
#icon_classes ⇒ Object
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
34 35 36 |
# File 'app/components/keystone/ui/feature_grid_component.rb', line 34 def subtitle? !@subtitle.nil? end |
#subtitle_classes ⇒ Object
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_classes ⇒ Object
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 |