Class: Keystone::Ui::CardLinkComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Keystone::Ui::CardLinkComponent
- 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
-
#href ⇒ Object
readonly
Returns the value of attribute href.
Instance Method Summary collapse
- #classes ⇒ Object
-
#initialize(href:, padding: :md, shadow: true) ⇒ CardLinkComponent
constructor
A new instance of CardLinkComponent.
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
#href ⇒ Object (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
#classes ⇒ Object
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 |