Class: IronAdmin::Ui::CardComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- IronAdmin::Ui::CardComponent
- Defined in:
- app/components/iron_admin/ui/card_component.rb
Overview
Renders a card container with optional header and footer.
Instance Attribute Summary collapse
-
#padding ⇒ Boolean
readonly
Whether to add padding to content.
-
#shadow ⇒ Boolean
readonly
Whether to show shadow.
Instance Method Summary collapse
-
#card_classes ⇒ String
private
CSS classes for card container.
-
#content_classes ⇒ String
private
CSS classes for card content area.
-
#initialize(padding: true, shadow: true) ⇒ CardComponent
constructor
A new instance of CardComponent.
-
#theme ⇒ IronAdmin::Configuration::Theme
private
Theme configuration.
Constructor Details
#initialize(padding: true, shadow: true) ⇒ CardComponent
Returns a new instance of CardComponent.
31 32 33 34 |
# File 'app/components/iron_admin/ui/card_component.rb', line 31 def initialize(padding: true, shadow: true) @padding = padding @shadow = shadow end |
Instance Attribute Details
#padding ⇒ Boolean (readonly)
Returns Whether to add padding to content.
24 25 26 |
# File 'app/components/iron_admin/ui/card_component.rb', line 24 def padding @padding end |
#shadow ⇒ Boolean (readonly)
Returns Whether to show shadow.
27 28 29 |
# File 'app/components/iron_admin/ui/card_component.rb', line 27 def shadow @shadow end |
Instance Method Details
#card_classes ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns CSS classes for card container.
44 45 46 47 48 |
# File 'app/components/iron_admin/ui/card_component.rb', line 44 def card_classes classes = ["overflow-hidden", theme.border_radius, theme.card_bg, "border", theme.card_border] classes << theme.card_shadow if shadow classes.join(" ") end |
#content_classes ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns CSS classes for card content area.
52 53 54 |
# File 'app/components/iron_admin/ui/card_component.rb', line 52 def content_classes padding ? "p-6" : "" end |
#theme ⇒ IronAdmin::Configuration::Theme
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Theme configuration.
38 39 40 |
# File 'app/components/iron_admin/ui/card_component.rb', line 38 def theme IronAdmin.configuration.theme end |