{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "expandable-bento-grid", "type": "registry:ui", "dependencies": [ "framer-motion", "lucide-react" ], "files": [ { "path": "components/ui/expandable-bento-grid.tsx", "content": "'use client'\r\n\r\nimport React, { useEffect, useId, useRef, useState } from 'react'\r\nimport { AnimatePresence, motion } from 'framer-motion'\r\nimport { useOutsideClick } from '@/hooks/use-outside-click'\r\nimport { X } from 'lucide-react'\r\n\r\nexport interface BentoGridProps {\r\n items: {\r\n id: string | number\r\n title: string\r\n subtitle?: string\r\n description?: string\r\n content: React.ReactNode\r\n icon?: React.ReactNode\r\n className?: string\r\n }[]\r\n}\r\n\r\nexport default function ExpandableBentoGrid({ items }: BentoGridProps) {\r\n const [active, setActive] = useState<(typeof items)[number] | boolean | null>(null)\r\n const ref = useRef(null)\r\n const id = useId()\r\n\r\n useEffect(() => {\r\n function onKeyDown(event: KeyboardEvent) {\r\n if (event.key === 'Escape') {\r\n setActive(false)\r\n }\r\n }\r\n\r\n if (active && typeof active === 'object') {\r\n document.body.style.overflow = 'hidden'\r\n } else {\r\n document.body.style.overflow = 'auto'\r\n }\r\n\r\n window.addEventListener('keydown', onKeyDown)\r\n return () => window.removeEventListener('keydown', onKeyDown)\r\n }, [active])\r\n\r\n useOutsideClick(ref, () => setActive(null))\r\n\r\n return (\r\n <>\r\n \r\n {active && typeof active === 'object' && (\r\n \r\n )}\r\n \r\n \r\n {active && typeof active === 'object' ? (\r\n
\r\n setActive(null)}\r\n >\r\n \r\n \r\n \r\n \r\n \r\n
\r\n {active.icon ? (\r\n
{active.icon}
\r\n ) : (\r\n
\r\n )}\r\n
\r\n \r\n\r\n
\r\n
\r\n
\r\n \r\n {active.title}\r\n \r\n \r\n {active.description}\r\n \r\n
\r\n\r\n \r\n Visit\r\n \r\n
\r\n\r\n\r\n \r\n
\r\n \r\n {active.content}\r\n \r\n
\r\n
\r\n \r\n \r\n
\r\n ) : null}\r\n \r\n
    \r\n {items.map((item) => (\r\n setActive(item)}\r\n className=\"p-4 flex flex-col md:flex-row justify-between items-center hover:bg-neutral-50 dark:hover:bg-neutral-800 rounded-xl cursor-pointer bg-blue-50/60 dark:bg-blue-900/10 border border-blue-100 dark:border-blue-800 transition-colors\"\r\n >\r\n
    \r\n \r\n
    \r\n {item.icon}\r\n
    \r\n
    \r\n
    \r\n \r\n {item.title}\r\n \r\n \r\n {item.subtitle}\r\n \r\n
    \r\n
    \r\n \r\n ))}\r\n
\r\n \r\n )\r\n}\r\n", "type": "registry:ui", "target": "components/ui/expandable-bento-grid.tsx" } ] }