Sha256: d18ae3523afdb7eef6187e824cf2b8647b1947f100393df08fc11f9bf3e654e8

Contents?: true

Size: 688 Bytes

Versions: 5

Compression:

Stored size: 688 Bytes

Contents

module Components::SheetHelper
  def render_sheet(**options, &block)
    options[:direction] ||= "left"
    options[:width] ||= "w-3/4"

    content_for :sheet_trigger, "", flush: true
    content_for :sheet_content, "", flush: true

    content = capture(&block) if block
    render "components/ui/sheet", content: content, options: options
  end

  def sheet_trigger(&block)
    content_for :sheet_trigger, capture(&block), flush: true
  end

  def sheet_content(&block)
    content_for :sheet_content, capture(&block), flush: true
  end

  def direction_class(direction)
    mappings = {
      "left": 'left-0',
      "right": 'right-0'
    }

    mappings[direction.to_sym]
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
shadcn-ui-0.0.10 app/helpers/components/sheet_helper.rb
shadcn-ui-0.0.8 app/helpers/components/sheet_helper.rb
shadcn-ui-0.0.5 app/helpers/components/sheet_helper.rb
shadcn-ui-0.0.4 app/helpers/components/sheet_helper.rb
shadcn-ui-0.0.3 app/helpers/components/sheet_helper.rb