Class: Panda::Core::Admin::PanelComponent
- Inherits:
-
Base
- Object
- Phlex::HTML
- Base
- Panda::Core::Admin::PanelComponent
show all
- Defined in:
- app/components/panda/core/admin/panel_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
#body(&block) ⇒ Object
36
37
38
|
# File 'app/components/panda/core/admin/panel_component.rb', line 36
def body(&block)
@body_content = block
end
|
#heading(**props) ⇒ Object
32
33
34
|
# File 'app/components/panda/core/admin/panel_component.rb', line 32
def heading(**props)
@heading_content = -> { render(Panda::Core::Admin::HeadingComponent.new(**props.merge(level: :panel))) }
end
|
#view_template(&block) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'app/components/panda/core/admin/panel_component.rb', line 7
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
div(class: "col-span-3 mt-5 rounded-lg shadow-md bg-dark shadow-inherit/20") do
@heading_content&.call
div(class: "p-4 text-black bg-white rounded-b-lg") do
if @body_content
@body_content.call
elsif @body_html
raw(@body_html)
end
end
end
end
|