Sha256: 653ab62eb10f50fedb76a78814686d6dbfa971dd9dc5de4b541241b6aad158da

Contents?: true

Size: 717 Bytes

Versions: 4

Compression:

Stored size: 717 Bytes

Contents

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

    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

4 entries across 4 versions & 1 rubygems

Version Path
shadcn-ui-0.0.15 app/helpers/components/sheet_helper.rb
shadcn-ui-0.0.14 app/helpers/components/sheet_helper.rb
shadcn-ui-0.0.13 app/helpers/components/sheet_helper.rb
shadcn-ui-0.0.12 app/helpers/components/sheet_helper.rb