Sha256: 79a9b25b16a7987aa354e1495054a5106adb031622de7ad6f00f588b58290df6

Contents?: true

Size: 1.44 KB

Versions: 10

Compression:

Stored size: 1.44 KB

Contents

# frozen_string_literal: true

module Primer
  module Alpha
    # @label Layout
    class LayoutPreview < ViewComponent::Preview
      # @label Playground
      # @param stacking_breakpoint [Symbol] select [sm, md, lg]
      # @param first_in_source [Symbol] select [sidebar, main]
      # @param gutter [Symbol] select [default, none, condensed, spacious]
      def playground(stacking_breakpoint: :sm, gutter: :default, first_in_source: :sidebar)
        render(Primer::Alpha::Layout.new(stacking_breakpoint: stacking_breakpoint, gutter: gutter, first_in_source: first_in_source)) do |c|
          c.with_main(bg: :attention, p: 6) do
            "Main content"
          end
          c.with_sidebar(bg: :accent, p: 6) do
            "Sidebar content"
          end
        end
      end

      # @label Default options
      # @param stacking_breakpoint [Symbol] select [sm, md, lg]
      # @param first_in_source [Symbol] select [sidebar, main]
      # @param gutter [Symbol] select [default, none, condensed, spacious]
      def default(stacking_breakpoint: :sm, gutter: :default, first_in_source: :sidebar)
        render(Primer::Alpha::Layout.new(stacking_breakpoint: stacking_breakpoint, gutter: gutter, first_in_source: first_in_source)) do |c|
          c.with_main(bg: :attention, p: 6) do
            "Main content"
          end
          c.with_sidebar(bg: :accent, p: 6) do
            "Sidebar content"
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
primer_view_components-0.0.114 previews/primer/alpha/layout_preview.rb
primer_view_components-0.0.113 previews/primer/alpha/layout_preview.rb
primer_view_components-0.0.112 previews/primer/alpha/layout_preview.rb
primer_view_components-0.0.111 previews/primer/alpha/layout_preview.rb
primer_view_components-0.0.110 previews/primer/alpha/layout_preview.rb
primer_view_components-0.0.109 previews/primer/alpha/layout_preview.rb
primer_view_components-0.0.108 previews/primer/alpha/layout_preview.rb
primer_view_components-0.0.107 previews/primer/alpha/layout_preview.rb
primer_view_components-0.0.106 previews/primer/alpha/layout_preview.rb
primer_view_components-0.0.105 previews/primer/alpha/layout_preview.rb