Class: Panda::Core::Admin::ProsePanelComponent
- Defined in:
- app/components/panda/core/admin/prose_panel_component.rb
Overview
Renders a PanelComponent containing prose-formatted text via simple_format.
Self-hides via render? when text is blank.
Lives in panda-core because rich-text prose display inside panels is a generic admin pattern (notes, descriptions, agendas) used across any Panda app, not specific to any single domain.
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#heading ⇒ Object
readonly
Returns the value of attribute heading.
-
#prose_class ⇒ Object
readonly
Returns the value of attribute prose_class.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(heading:, text:, prose_class: "", **attrs) ⇒ ProsePanelComponent
constructor
A new instance of ProsePanelComponent.
- #prose_classes ⇒ Object
- #render? ⇒ Boolean
Constructor Details
#initialize(heading:, text:, prose_class: "", **attrs) ⇒ ProsePanelComponent
Returns a new instance of ProsePanelComponent.
25 26 27 28 29 30 |
# File 'app/components/panda/core/admin/prose_panel_component.rb', line 25 def initialize(heading:, text:, prose_class: "", **attrs) @heading = heading @text = text @prose_class = prose_class super(**attrs) end |
Instance Attribute Details
#heading ⇒ Object (readonly)
Returns the value of attribute heading.
23 24 25 |
# File 'app/components/panda/core/admin/prose_panel_component.rb', line 23 def heading @heading end |
#prose_class ⇒ Object (readonly)
Returns the value of attribute prose_class.
23 24 25 |
# File 'app/components/panda/core/admin/prose_panel_component.rb', line 23 def prose_class @prose_class end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
23 24 25 |
# File 'app/components/panda/core/admin/prose_panel_component.rb', line 23 def text @text end |
Instance Method Details
#prose_classes ⇒ Object
36 37 38 39 |
# File 'app/components/panda/core/admin/prose_panel_component.rb', line 36 def prose_classes base = "prose prose-sm max-w-none" prose_class.present? ? "#{base} #{prose_class}" : base end |
#render? ⇒ Boolean
32 33 34 |
# File 'app/components/panda/core/admin/prose_panel_component.rb', line 32 def render? text.present? end |