Class: Keystone::Ui::CardLinkComponent

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

Constant Summary collapse

BASE_CLASSES =
"block rounded-lg border border-gray-200 bg-white dark:border-zinc-700 dark:bg-zinc-900"
SHADOW_CLASS =
"shadow-sm"
PADDING_CLASSES =
{ sm: "p-3", md: "p-4", lg: "p-6" }.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(href:, padding: :md, shadow: true) ⇒ CardLinkComponent

Returns a new instance of CardLinkComponent.



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

def initialize(href:, padding: :md, shadow: true)
  @href = href
  @padding = padding
  @shadow = shadow
end

Instance Attribute Details

#hrefObject (readonly)

Returns the value of attribute href.



10
11
12
# File 'app/components/keystone/ui/card_link_component.rb', line 10

def href
  @href
end

Instance Method Details

#classesObject



18
19
20
21
22
# File 'app/components/keystone/ui/card_link_component.rb', line 18

def classes
  tokens = [ BASE_CLASSES, "hover:border-accent-500/50", PADDING_CLASSES.fetch(@padding) ]
  tokens << SHADOW_CLASS if @shadow
  tokens.join(" ")
end