Module: StyleGuideHelper

Defined in:
app/helpers/style_guide_helper.rb

Overview

Helper methods for the style guide

Instance Method Summary collapse

Instance Method Details

#example_with_code(title, code = nil, options = {}) { ... } ⇒ String

Render a component example with preview and code

Parameters:

  • title (String)

    The example title

  • code (String) (defaults to: nil)

    The ERB code to display

  • options (Hash) (defaults to: {})

    Additional options

Yields:

  • Block containing the component to render

Returns:

  • (String)

    HTML for the example with code



11
12
13
14
15
# File 'app/helpers/style_guide_helper.rb', line 11

def example_with_code(title, code = nil, options = {}, &block)
   :div, class: "code-example-wrapper #{options[:wrapper_class]}" do
    preview_section(title, &block) + code_section(code)
  end
end