Sha256: 0534e96d0ed0ca5f5770d8dc4023b2f3a17b2fb941aa8e6ff7e057df727b42b5
Contents?: true
Size: 1.16 KB
Versions: 2
Compression:
Stored size: 1.16 KB
Contents
module ExamplesHelper def render_component_header(title:, description:) render "layouts/documentation/component_header", title:, description: end def render_example render "layouts/documentation/examples" end def render_preview render "layouts/documentation/preview" end def render_usage(name) render "examples/components/#{name}/usage" end def code_partial(name, language) content_tag :pre, class: "code-sample py-4 px-4", data: {controller: "highlight"} do content_tag :code, class: "language-#{language}" do html_escape(File.read(Rails.root.join("app", "views", "examples", "components", "#{name}.erb"))) end end end def code_sample(content = "", language:, &block) content_tag :pre, class: "code-sample px-4 my-2 pb-5", data: {controller: "highlight"} do content_tag :code, class: "language-#{language}" do content yield if block end end end def inline_code(content = nil, &block) content_tag :code, class: "relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono font-semibold" do content || yield(block) end end alias_method :code, :inline_code end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
shadcn-ui-0.0.2 | app/helpers/examples_helper.rb |
shadcn-ui-0.0.1 | app/helpers/examples_helper.rb |