Class: Keystone::Ui::CtaBannerComponent

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

Constant Summary collapse

CARD_LAYOUT_CLASSES =
"rounded-2xl border px-6 py-12 text-center lg:px-16 lg:py-16"
TITLE_BASE_CLASSES =
"mb-4 text-3xl font-bold tracking-tight sm:text-4xl"
SUBTITLE_BASE_CLASSES =
"mx-auto mb-8 max-w-2xl text-lg"
ACTIONS_CLASSES =
"flex flex-wrap justify-center gap-4"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title:, subtitle: nil) ⇒ CtaBannerComponent

Returns a new instance of CtaBannerComponent.



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

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

Instance Attribute Details

#subtitleObject (readonly)

Returns the value of attribute subtitle.



11
12
13
# File 'app/components/keystone/ui/cta_banner_component.rb', line 11

def subtitle
  @subtitle
end

#titleObject (readonly)

Returns the value of attribute title.



11
12
13
# File 'app/components/keystone/ui/cta_banner_component.rb', line 11

def title
  @title
end

Instance Method Details

#actions_classesObject



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

def actions_classes
  ACTIONS_CLASSES
end

#classesObject



18
19
20
# File 'app/components/keystone/ui/cta_banner_component.rb', line 18

def classes
  "#{CARD_LAYOUT_CLASSES} border-surface-200 dark:border-surface-700 bg-surface-50 dark:bg-surface-800"
end

#subtitle?Boolean

Returns:

  • (Boolean)


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

def subtitle?
  !@subtitle.nil?
end

#subtitle_classesObject



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

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

#title_classesObject



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

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