Class: Prose::Component
- Inherits:
-
Lookbook::BaseComponent
- Object
- Lookbook::BaseComponent
- Prose::Component
- Defined in:
- app/components/lookbook/prose/component.rb
Instance Method Summary collapse
-
#initialize(size: :sm, markdown: true, **html_attrs) ⇒ Component
constructor
A new instance of Component.
- #rendered_content ⇒ Object
- #size_class ⇒ Object
Constructor Details
#initialize(size: :sm, markdown: true, **html_attrs) ⇒ Component
Returns a new instance of Component.
3 4 5 6 7 |
# File 'app/components/lookbook/prose/component.rb', line 3 def initialize(size: :sm, markdown: true, **html_attrs) @size = size @markdown = markdown super(**html_attrs) end |
Instance Method Details
#rendered_content ⇒ Object
9 10 11 |
# File 'app/components/lookbook/prose/component.rb', line 9 def rendered_content @markdown ? MarkdownRenderer.call(content.strip_heredoc) : helpers.raw(content) end |
#size_class ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'app/components/lookbook/prose/component.rb', line 13 def size_class case @size when :sm "prose-sm" when :lg "prose-lg" else "prose-sm lg:prose-base" end end |