Class: UI::SidebarInset
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- UI::SidebarInset
- Includes:
- SidebarInsetBehavior
- Defined in:
- app/components/ui/sidebar_inset.rb
Overview
SidebarInset - Phlex implementation
Main content area that sits alongside the sidebar. Should be used as a sibling to Sidebar within SidebarProvider.
Instance Method Summary collapse
-
#initialize(classes: "", **attributes) ⇒ SidebarInset
constructor
A new instance of SidebarInset.
- #view_template(&block) ⇒ Object
Methods included from SidebarInsetBehavior
#sidebar_inset_classes, #sidebar_inset_data_attributes, #sidebar_inset_html_attributes
Constructor Details
#initialize(classes: "", **attributes) ⇒ SidebarInset
Returns a new instance of SidebarInset.
20 21 22 23 |
# File 'app/components/ui/sidebar_inset.rb', line 20 def initialize(classes: "", **attributes) @classes = classes @attributes = attributes end |
Instance Method Details
#view_template(&block) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/components/ui/sidebar_inset.rb', line 25 def view_template(&block) all_attributes = # Merge classes with TailwindMerge 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 # Deep merge other attributes (excluding class) all_attributes = all_attributes.deep_merge(@attributes.except(:class)) main(**all_attributes, &block) end |