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