Class: Panda::Core::Admin::ContainerComponent
- Inherits:
-
Base
- Object
- Phlex::HTML
- Base
- Panda::Core::Admin::ContainerComponent
show all
- Defined in:
- app/components/panda/core/admin/container_component.rb
Constant Summary
Constants inherited
from Base
Base::TAILWIND_MERGER
Instance Method Summary
collapse
Methods inherited from Base
#after_template, #attrs, #before_template, #default_attrs, #merge_attrs, #tailwind_merge_attrs
Instance Method Details
#content(&block) ⇒ Object
49
50
51
52
53
54
55
56
|
# File 'app/components/panda/core/admin/container_component.rb', line 49
def content(&block)
@main_content = if defined?(view_context) && view_context
-> { raw(view_context.capture(&block)) }
else
block
end
end
|
#heading(**props, &block) ⇒ Object
58
59
60
|
# File 'app/components/panda/core/admin/container_component.rb', line 58
def heading(**props, &block)
@heading_content = -> { render(Panda::Core::Admin::HeadingComponent.new(**props), &block) }
end
|
#slideover(**props, &block) ⇒ Object
Also known as:
with_slideover
66
67
68
69
|
# File 'app/components/panda/core/admin/container_component.rb', line 66
def slideover(**props, &block)
@slideover_title = props[:title] || "Settings"
@slideover_block = block end
|
#tab_bar(**props, &block) ⇒ Object
#view_template(&block) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'app/components/panda/core/admin/container_component.rb', line 9
def view_template(&block)
if block_given?
if defined?(view_context) && view_context
@body_html = view_context.capture { yield(self) }
else
yield(self)
end
end
if @slideover_block && @slideover_title && defined?(view_context) && view_context
view_context.content_for(:sidebar) do
view_context.capture(&@slideover_block)
end
view_context.content_for(:sidebar_title, @slideover_title)
end
main(class: "overflow-auto flex-1 h-full min-h-full max-h-full") do
div(class: "overflow-auto px-2 pt-4 mx-auto sm:px-6 lg:px-6") do
@heading_content&.call
@tab_bar_content&.call
section(class: section_classes) do
div(class: "flex-1 mt-4 w-full h-full") do
if @main_content
@main_content.call
elsif @body_html
raw(@body_html)
end
end
end
end
end
end
|