Class: Keystone::Ui::HeroComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Keystone::Ui::HeroComponent
- Defined in:
- app/components/keystone/ui/hero_component.rb
Constant Summary collapse
- WRAPPER_CLASSES =
"relative min-h-screen pt-24"- INNER_CLASSES =
"mx-auto max-w-6xl px-6 py-24 lg:py-32"- CONTENT_COLUMN_CLASSES =
"flex flex-col gap-8"- CENTERED_COLUMN_CLASSES =
"items-center"- SPLIT_CLASSES =
"grid gap-12 lg:grid-cols-2 lg:gap-16 items-center"- CENTERED_CLASSES =
"flex flex-col items-center text-center"- TITLE_BASE_CLASSES =
"text-4xl font-bold tracking-tight sm:text-5xl lg:text-6xl"- SUBTITLE_BASE_CLASSES =
"max-w-lg text-lg"- BADGE_BASE_CLASSES =
"inline-flex w-fit items-center gap-2 rounded-full border px-4 py-1.5 text-sm"- ACTIONS_CLASSES =
"flex flex-wrap gap-4"
Instance Attribute Summary collapse
-
#badge ⇒ Object
readonly
Returns the value of attribute badge.
-
#subtitle ⇒ Object
readonly
Returns the value of attribute subtitle.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #actions_classes ⇒ Object
- #badge? ⇒ Boolean
- #badge_classes ⇒ Object
- #classes ⇒ Object
- #content_classes ⇒ Object
-
#initialize(title:, subtitle: nil, badge: nil, layout: :split) ⇒ HeroComponent
constructor
A new instance of HeroComponent.
- #inner_classes ⇒ Object
- #inner_content_classes ⇒ Object
- #subtitle? ⇒ Boolean
- #subtitle_classes ⇒ Object
- #title_classes ⇒ Object
Constructor Details
#initialize(title:, subtitle: nil, badge: nil, layout: :split) ⇒ HeroComponent
Returns a new instance of HeroComponent.
24 25 26 27 28 29 |
# File 'app/components/keystone/ui/hero_component.rb', line 24 def initialize(title:, subtitle: nil, badge: nil, layout: :split) @title = title @subtitle = subtitle @badge = badge @layout = layout end |
Instance Attribute Details
#badge ⇒ Object (readonly)
Returns the value of attribute badge.
22 23 24 |
# File 'app/components/keystone/ui/hero_component.rb', line 22 def badge @badge end |
#subtitle ⇒ Object (readonly)
Returns the value of attribute subtitle.
22 23 24 |
# File 'app/components/keystone/ui/hero_component.rb', line 22 def subtitle @subtitle end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
22 23 24 |
# File 'app/components/keystone/ui/hero_component.rb', line 22 def title @title end |
Instance Method Details
#actions_classes ⇒ Object
69 70 71 |
# File 'app/components/keystone/ui/hero_component.rb', line 69 def actions_classes ACTIONS_CLASSES end |
#badge? ⇒ Boolean
65 66 67 |
# File 'app/components/keystone/ui/hero_component.rb', line 65 def badge? !@badge.nil? end |
#badge_classes ⇒ Object
61 62 63 |
# File 'app/components/keystone/ui/hero_component.rb', line 61 def badge_classes "#{BADGE_BASE_CLASSES} border-accent-500/20 bg-accent-500/10 text-accent-600 dark:text-accent-400" end |
#classes ⇒ Object
31 32 33 |
# File 'app/components/keystone/ui/hero_component.rb', line 31 def classes WRAPPER_CLASSES end |
#content_classes ⇒ Object
39 40 41 |
# File 'app/components/keystone/ui/hero_component.rb', line 39 def content_classes @layout == :centered ? CENTERED_CLASSES : SPLIT_CLASSES end |
#inner_classes ⇒ Object
35 36 37 |
# File 'app/components/keystone/ui/hero_component.rb', line 35 def inner_classes INNER_CLASSES end |
#inner_content_classes ⇒ Object
43 44 45 46 47 |
# File 'app/components/keystone/ui/hero_component.rb', line 43 def inner_content_classes return CONTENT_COLUMN_CLASSES unless @layout == :centered "#{CONTENT_COLUMN_CLASSES} #{CENTERED_COLUMN_CLASSES}" end |
#subtitle? ⇒ Boolean
57 58 59 |
# File 'app/components/keystone/ui/hero_component.rb', line 57 def subtitle? !@subtitle.nil? end |
#subtitle_classes ⇒ Object
53 54 55 |
# File 'app/components/keystone/ui/hero_component.rb', line 53 def subtitle_classes "#{SUBTITLE_BASE_CLASSES} text-surface-500 dark:text-surface-400" end |
#title_classes ⇒ Object
49 50 51 |
# File 'app/components/keystone/ui/hero_component.rb', line 49 def title_classes "#{TITLE_BASE_CLASSES} text-surface-900 dark:text-white" end |