Class: DaisyUI::Card::Body
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- DaisyUI::Card::Body
- Defined in:
- app/components/daisy_ui/data_display/card/body.rb
Overview
Body component for the card, containing title, description and actions
Instance Method Summary collapse
- #before_render ⇒ Object
- #call ⇒ Object
-
#initialize(variant: nil, description: nil, title: nil, button: nil, **system_arguments) ⇒ Body
constructor
A new instance of Body.
Constructor Details
#initialize(variant: nil, description: nil, title: nil, button: nil, **system_arguments) ⇒ Body
Returns a new instance of Body.
54 55 56 57 58 59 60 61 62 63 64 |
# File 'app/components/daisy_ui/data_display/card/body.rb', line 54 def initialize(variant: nil, description: nil, title: nil, button: nil, **system_arguments) @variant = variant @description = description @title = title @button = super(**system_arguments) end |
Instance Method Details
#before_render ⇒ Object
76 77 78 79 80 |
# File 'app/components/daisy_ui/data_display/card/body.rb', line 76 def before_render with_title(@title) if @title && !title? with_description { tag.p(@description) } if @description && !description? if @button && !actions? end |
#call ⇒ Object
66 67 68 69 70 71 72 73 74 |
# File 'app/components/daisy_ui/data_display/card/body.rb', line 66 def call tag.div(**html_attributes) do safe_join([ title, render_description, actions ].compact) end end |