Class: Prose::Component
- Inherits:
-
Lookbook::BaseComponent
- Object
- Lookbook::BaseComponent
- Prose::Component
- Includes:
- Lookbook::OutputHelper
- Defined in:
- app/components/lookbook/prose/component.rb
Instance Method Summary collapse
-
#initialize(size: :md, markdown: true, **html_attrs) ⇒ Component
constructor
A new instance of Component.
- #rendered_content ⇒ Object
- #size_class ⇒ Object
Methods included from Lookbook::OutputHelper
#beautify, #highlight, #markdown, #pretty_json
Constructor Details
#initialize(size: :md, markdown: true, **html_attrs) ⇒ Component
Returns a new instance of Component.
5 6 7 8 9 |
# File 'app/components/lookbook/prose/component.rb', line 5 def initialize(size: :md, markdown: true, **html_attrs) @size = size @markdown = markdown super(**html_attrs) end |
Instance Method Details
#rendered_content ⇒ Object
11 12 13 |
# File 'app/components/lookbook/prose/component.rb', line 11 def rendered_content @markdown ? markdown(content.strip_heredoc) : helpers.raw(content) end |
#size_class ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'app/components/lookbook/prose/component.rb', line 15 def size_class case @size when :sm "prose-sm" when :lg "prose-lg" else "" end end |