Class: Prose::Component

Inherits:
Lookbook::BaseComponent
  • Object
show all
Defined in:
app/components/lookbook/prose/component.rb

Instance Method Summary collapse

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_contentObject



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_classObject



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