Class: UI::SidebarFooter

Inherits:
Phlex::HTML
  • Object
show all
Includes:
SidebarFooterBehavior
Defined in:
app/components/ui/sidebar_footer.rb

Overview

Footer - Phlex implementation

Fixed footer section at the bottom of the sidebar.

Examples:

Basic usage

render UI::Footer.new do
  # Footer content (user menu, settings, etc.)
end

Instance Method Summary collapse

Methods included from SidebarFooterBehavior

#sidebar_footer_classes, #sidebar_footer_data_attributes, #sidebar_footer_html_attributes

Constructor Details

#initialize(classes: "", **attributes) ⇒ SidebarFooter

Returns a new instance of SidebarFooter.

Parameters:

  • classes (String) (defaults to: "")

    Additional CSS classes

  • attributes (Hash)

    Additional HTML attributes



16
17
18
19
# File 'app/components/ui/sidebar_footer.rb', line 16

def initialize(classes: "", **attributes)
  @classes = classes
  @attributes = attributes
end

Instance Method Details

#view_template(&block) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/components/ui/sidebar_footer.rb', line 21

def view_template(&block)
  all_attributes = sidebar_footer_html_attributes

  if @attributes.key?(:class)
    merged_class = TailwindMerge::Merger.new.merge([
      all_attributes[:class],
      @attributes[:class]
    ].compact.join(" "))
    all_attributes = all_attributes.merge(class: merged_class)
  end

  all_attributes = all_attributes.deep_merge(@attributes.except(:class))

  div(**all_attributes, &block)
end