Class: Shadcn::DrawerContentComponent

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

Overview

Drawer Content component

Constant Summary collapse

OVERLAY_CLASSES =
"fixed inset-0 z-50 bg-black/80"
CONTENT_CLASSES =
{
  bottom: "fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",
  top: "fixed inset-x-0 top-0 z-50 mb-24 flex h-auto flex-col rounded-b-[10px] border bg-background",
  left: "fixed inset-y-0 left-0 z-50 h-full w-3/4 max-w-sm flex flex-col border-r bg-background",
  right: "fixed inset-y-0 right-0 z-50 h-full w-3/4 max-w-sm flex flex-col border-l bg-background"
}.freeze

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(direction: :bottom, **options, &block) ⇒ DrawerContentComponent

Returns a new instance of DrawerContentComponent.

Parameters:

  • direction (Symbol) (defaults to: :bottom)

    :bottom, :top, :left, or :right



22
23
24
25
# File 'app/components/shadcn/drawer_content_component.rb', line 22

def initialize(direction: :bottom, **options, &block)
  super(**options, &block)
  @direction = direction
end

Instance Method Details

#callObject



27
28
29
# File 'app/components/shadcn/drawer_content_component.rb', line 27

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