Module: UI::CardFooterBehavior

Included in:
CardFooter, CardFooterComponent
Defined in:
app/behaviors/ui/card_footer_behavior.rb

Overview

FooterBehavior

Shared behavior for CardFooter component across ERB, ViewComponent, and Phlex implementations.

Instance Method Summary collapse

Instance Method Details



19
20
21
22
23
24
25
# File 'app/behaviors/ui/card_footer_behavior.rb', line 19

def card_footer_classes
  classes_value = respond_to?(:classes, true) ? classes : @classes
  TailwindMerge::Merger.new.merge([
    card_footer_base_classes,
    classes_value
  ].compact.join(" "))
end


12
13
14
15
16
17
# File 'app/behaviors/ui/card_footer_behavior.rb', line 12

def card_footer_html_attributes
  {
    class: card_footer_classes,
    data: {slot: "card-footer"}
  }
end


7
8
9
10
# File 'app/behaviors/ui/card_footer_behavior.rb', line 7

def render_card_footer(&content_block)
  all_attributes = card_footer_html_attributes.deep_merge(@attributes)
  (:div, **all_attributes, &content_block)
end