Class: Shadcn::SheetContentComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/shadcn/sheet_content_component.rb

Overview

Sheet Content component

Constant Summary collapse

OVERLAY_CLASSES =
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
BASE_CONTENT_CLASSES =
"fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out"
CLOSE_CLASSES =
"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary"

Instance Attribute Summary

Attributes inherited from BaseComponent

#class_name, #data, #html_options

Instance Method Summary collapse

Methods inherited from BaseComponent

#content

Methods included from Rails::Helpers::ClassNameHelper

#cn

Constructor Details

#initialize(side: :right, **options) ⇒ SheetContentComponent

Returns a new instance of SheetContentComponent.

Parameters:

  • (defaults to: :right)

    Side the sheet appears from



24
25
26
27
# File 'app/components/shadcn/sheet_content_component.rb', line 24

def initialize(side: :right, **options)
  super(**options)
  @side = side.to_sym
end

Instance Method Details

#callObject



29
30
31
# File 'app/components/shadcn/sheet_content_component.rb', line 29

def call
  (:template, content_wrapper, { "data-shadcn--sheet-target": "template" })
end