{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "use-idle-demo",
  "title": "UseIdleDemo",
  "description": "use-idle's hook in action.",
  "registryDependencies": [
    "card",
    "badge",
    "button",
    "https://guarahooks.com/r/use-idle.json"
  ],
  "files": [
    {
      "path": "registry/example/use-idle-demo.tsx",
      "content": "'use client';\n\nimport React from 'react';\n\nimport { Badge } from '@/components/ui/badge';\nimport { Button } from '@/components/ui/button';\nimport {\n  Card,\n  CardContent,\n  CardDescription,\n  CardHeader,\n  CardTitle,\n} from '@/components/ui/card';\n\nimport { cn } from '@/lib/utils';\n\nimport { useIdle } from '@/hooks/guarahooks/use-idle';\n\nexport default function UseIdleDemo() {\n  // 2 seconds of timeout\n  const [idle, resetIdle] = useIdle(2000);\n\n  return (\n    <Card className=\"relative max-w-sm w-full\">\n      <CardHeader>\n        <CardTitle>useIdle</CardTitle>\n        <CardDescription>\n          This component uses the <code>useIdle</code> hook to detect if the\n          user is idle for a given timeout (2 seconds).\n        </CardDescription>\n      </CardHeader>\n      <CardContent className=\"space-y-4\">\n        <Badge\n          variant=\"secondary\"\n          className={cn(\n            'w-fit',\n            idle\n              ? 'bg-red-500/30 border-red-500'\n              : 'bg-green-500/30 border-green-500',\n          )}\n        >\n          The user is{' '}\n          <p\n            className={cn(\n              'text-foreground font-bold uppercase',\n              idle ? 'text-red-500' : 'text-green-500',\n            )}\n          >\n            {idle ? 'idle' : 'active'}\n          </p>\n        </Badge>\n        <p className=\"text-sm text-muted-foreground\">\n          Interact with the page (keyboard, mouse, scroll, etc) to reset the\n          idle timer.\n        </p>\n        <Button size=\"sm\" onClick={resetIdle}>\n          Or click here\n        </Button>\n      </CardContent>\n    </Card>\n  );\n}\n",
      "type": "registry:example",
      "target": "components/example/use-idle-demo.tsx"
    }
  ],
  "type": "registry:example"
}