Class: Panda::Core::Admin::HeadingComponent
- Inherits:
-
Base
- Object
- Phlex::HTML
- Base
- Panda::Core::Admin::HeadingComponent
show all
- Defined in:
- app/components/panda/core/admin/heading_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
37
38
39
40
|
# File 'app/components/panda/core/admin/heading_component.rb', line 37
def button(**props)
@buttons ||= []
@buttons << Panda::Core::Admin::ButtonComponent.new(**props)
end
|
#view_template(&block) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'app/components/panda/core/admin/heading_component.rb', line 13
def view_template(&block)
instance_eval(&block) if block_given?
div(class: "heading-wrapper") do
case @level
when 1
h1(class: heading_classes(@meta.present?)) { render_content }
when 2
h2(class: heading_classes(@meta.present?)) { render_content }
when 3
h3(class: heading_classes(@meta.present?)) { render_content }
when :panel
h3(class: panel_heading_classes) { @text }
else
h2(class: heading_classes(@meta.present?)) { render_content }
end
if @meta
p(class: "text-sm text-black/60 -mt-1 mb-5") { raw(@meta) }
end
end
end
|