Module: UI::CardContentBehavior
- Included in:
- CardContent, CardContentComponent
- Defined in:
- app/behaviors/ui/card_content_behavior.rb
Overview
ContentBehavior
Shared behavior for CardContent component across ERB, ViewComponent, and Phlex implementations.
Instance Method Summary collapse
- #card_content_classes ⇒ Object
- #card_content_html_attributes ⇒ Object
- #render_card_content(&content_block) ⇒ Object
Instance Method Details
#card_content_classes ⇒ Object
19 20 21 22 23 24 25 |
# File 'app/behaviors/ui/card_content_behavior.rb', line 19 def card_content_classes classes_value = respond_to?(:classes, true) ? classes : @classes TailwindMerge::Merger.new.merge([ card_content_base_classes, classes_value ].compact.join(" ")) end |
#card_content_html_attributes ⇒ Object
12 13 14 15 16 17 |
# File 'app/behaviors/ui/card_content_behavior.rb', line 12 def card_content_html_attributes { class: card_content_classes, data: {slot: "card-content"} } end |
#render_card_content(&content_block) ⇒ Object
7 8 9 10 |
# File 'app/behaviors/ui/card_content_behavior.rb', line 7 def render_card_content(&content_block) all_attributes = card_content_html_attributes.deep_merge(@attributes) content_tag(:div, **all_attributes, &content_block) end |