Download frontend/src/components/workspace/SlideOverPanel.jsx from Seth0330/qualifier: direct link, hf CLI and curl.
- Browser
- Download file 2.26 kB
-
https://huggingface.co/spaces/Seth0330/qualifier/resolve/main/frontend/src/components/workspace/SlideOverPanel.jsx
- Command line
-
hf download hf://spaces/Seth0330/qualifier/frontend/src/components/workspace/SlideOverPanel.jsx
-
curl -L -o SlideOverPanel.jsx https://huggingface.co/spaces/Seth0330/qualifier/resolve/main/frontend/src/components/workspace/SlideOverPanel.jsx
2.26 kB
| import React, { useEffect } from 'react'; | |
| import { Button } from '@/components/ui/button'; | |
| import { cn } from '@/lib/utils'; | |
| /** | |
| * Right-side slide-over (same pattern as Leads detail). Use on Leads, Contacts, and Deals. | |
| */ | |
| export default function SlideOverPanel({ | |
| open, | |
| onClose, | |
| title, | |
| subtitle, | |
| headerActions = null, | |
| children, | |
| widthClassName = 'max-w-lg', | |
| }) { | |
| useEffect(() => { | |
| if (!open) return; | |
| const onKey = (e) => { | |
| if (e.key === 'Escape') onClose(); | |
| }; | |
| window.addEventListener('keydown', onKey); | |
| return () => window.removeEventListener('keydown', onKey); | |
| }, [open, onClose]); | |
| if (!open) return null; | |
| return ( | |
| <div className="fixed inset-0 z-50 flex justify-end bg-black/30" role="dialog" aria-modal="true"> | |
| <button | |
| type="button" | |
| className="flex-1 cursor-default min-h-0" | |
| aria-label="Close panel" | |
| onClick={onClose} | |
| /> | |
| <div | |
| className={cn( | |
| 'w-full bg-white shadow-xl h-full overflow-y-auto border-l border-slate-200 p-6', | |
| widthClassName | |
| )} | |
| > | |
| <div className="flex justify-between items-start gap-4 mb-6"> | |
| <div className="min-w-0 pr-2 flex-1"> | |
| {typeof title === 'string' || title == null ? ( | |
| <h3 className="text-lg font-bold text-slate-900 truncate">{title || ''}</h3> | |
| ) : ( | |
| <div className="w-full min-w-0">{title}</div> | |
| )} | |
| {subtitle ? ( | |
| <p className="text-sm text-slate-500 mt-1 break-words">{subtitle}</p> | |
| ) : null} | |
| </div> | |
| <div className="flex items-center gap-2 shrink-0"> | |
| {headerActions} | |
| <Button variant="ghost" size="sm" onClick={onClose}> | |
| Close | |
| </Button> | |
| </div> | |
| </div> | |
| {children} | |
| </div> | |
| </div> | |
| ); | |
| } | |