Class: UI::SidebarContent
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- UI::SidebarContent
- Includes:
- SidebarContentBehavior
- Defined in:
- app/components/ui/sidebar_content.rb
Overview
Content - Phlex implementation
Scrollable content area in the middle of the sidebar.
Instance Method Summary collapse
-
#initialize(classes: "", **attributes) ⇒ SidebarContent
constructor
A new instance of SidebarContent.
- #view_template(&block) ⇒ Object
Methods included from SidebarContentBehavior
#sidebar_content_classes, #sidebar_content_data_attributes, #sidebar_content_html_attributes
Constructor Details
#initialize(classes: "", **attributes) ⇒ SidebarContent
Returns a new instance of SidebarContent.
14 15 16 17 |
# File 'app/components/ui/sidebar_content.rb', line 14 def initialize(classes: "", **attributes) @classes = classes @attributes = attributes end |
Instance Method Details
#view_template(&block) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/components/ui/sidebar_content.rb', line 19 def view_template(&block) all_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 |