Class: Keystone::Ui::PanelComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Keystone::Ui::PanelComponent
- Defined in:
- app/components/keystone/ui/panel_component.rb
Constant Summary collapse
- PADDING_CLASSES =
{ sm: "p-4", md: "p-5", lg: "p-6" }.freeze
- RADIUS_CLASSES =
{ md: "rounded-lg", lg: "rounded-xl", xl: "rounded-2xl" }.freeze
- BASE_CLASSES =
"border border-gray-200 bg-white dark:bg-zinc-900 dark:border-zinc-700"- SHADOW_CLASS =
"shadow-sm"
Instance Method Summary collapse
- #classes ⇒ Object
-
#initialize(padding: :md, radius: :lg, shadow: true) ⇒ PanelComponent
constructor
A new instance of PanelComponent.
Constructor Details
#initialize(padding: :md, radius: :lg, shadow: true) ⇒ PanelComponent
Returns a new instance of PanelComponent.
9 10 11 12 13 |
# File 'app/components/keystone/ui/panel_component.rb', line 9 def initialize(padding: :md, radius: :lg, shadow: true) @padding = padding @radius = radius @shadow = shadow end |
Instance Method Details
#classes ⇒ Object
18 19 20 21 22 |
# File 'app/components/keystone/ui/panel_component.rb', line 18 def classes tokens = [ RADIUS_CLASSES.fetch(@radius), BASE_CLASSES, PADDING_CLASSES.fetch(@padding) ] tokens << SHADOW_CLASS if @shadow tokens.join(" ") end |