{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "scroll-area4",
  "title": "Scroll area",
  "description": "Scroll area built with shadcn/ui.",
  "registryDependencies": [
    "scroll-area"
  ],
  "files": [
    {
      "path": "contents/components/scroll-area/4/index.tsx",
      "content": "\"use client\";\n\nimport { ScrollArea } from \"@/components/ui/scroll-area\";\n\nconst notifications = [\n  {\n    id: 1,\n    user: \"Chris Tompson\",\n    action: \"requested review on PR #42: Feature implementation.\",\n    time: \"15 minutes ago\",\n    dateGroup: \"Today\",\n    unread: true,\n    highlighted: false\n  },\n  {\n    id: 2,\n    user: \"Emma Davis\",\n    action: \"shared New component library.\",\n    time: \"45 minutes ago\",\n    dateGroup: \"Today\",\n    unread: true,\n    highlighted: true\n  },\n  {\n    id: 3,\n    user: \"James Wilson\",\n    action: \"assigned you to API integration task.\",\n    time: \"4 hours ago\",\n    dateGroup: \"Today\",\n    unread: false,\n    highlighted: false\n  },\n  {\n    id: 4,\n    user: \"Alex Morgan\",\n    action: \"replied to your comment in Authentication flow.\",\n    time: \"12 hours ago\",\n    dateGroup: \"Today\",\n    unread: false,\n    highlighted: false\n  },\n  {\n    id: 5,\n    user: \"Sarah Chen\",\n    action: \"commented on Dashboard redesign.\",\n    time: \"2 days ago\",\n    dateGroup: \"Yesterday\",\n    unread: false,\n    highlighted: false\n  },\n  {\n    id: 7,\n    user: \"Robert Kim\",\n    action: \"approved your changes in Payment gateway PR.\",\n    time: \"3 days ago\",\n    dateGroup: \"Yesterday\",\n    unread: false,\n    highlighted: false\n  },\n  {\n    id: 6,\n    user: \"Miky Derya\",\n    action: \"mentioned you in shadcnuikit.com open graph image.\",\n    time: \"2 weeks ago\",\n    dateGroup: \"This Week\",\n    unread: false,\n    highlighted: false\n  },\n  {\n    id: 8,\n    user: \"Laura Martinez\",\n    action: \"created new issue: Bug in user authentication.\",\n    time: \"5 days ago\",\n    dateGroup: \"This Week\",\n    unread: false,\n    highlighted: false\n  },\n  {\n    id: 9,\n    user: \"Daniel Park\",\n    action: \"merged your pull request: Dark mode implementation.\",\n    time: \"1 week ago\",\n    dateGroup: \"This Week\",\n    unread: false,\n    highlighted: false\n  },\n  {\n    id: 10,\n    user: \"Olivia Brown\",\n    action: \"requested changes on Mobile responsive design PR.\",\n    time: \"1 week ago\",\n    dateGroup: \"This Week\",\n    unread: false,\n    highlighted: false\n  },\n  {\n    id: 11,\n    user: \"Michael Chen\",\n    action: \"commented on Database migration strategy.\",\n    time: \"2 weeks ago\",\n    dateGroup: \"Last Week\",\n    unread: false,\n    highlighted: false\n  },\n  {\n    id: 12,\n    user: \"Sophia Lee\",\n    action: \"tagged you in Performance optimization discussion.\",\n    time: \"3 weeks ago\",\n    dateGroup: \"Last Week\",\n    unread: false,\n    highlighted: false\n  },\n  {\n    id: 13,\n    user: \"David Johnson\",\n    action: \"closed issue: Memory leak in image processing.\",\n    time: \"3 weeks ago\",\n    dateGroup: \"Last Week\",\n    unread: false,\n    highlighted: false\n  },\n  {\n    id: 14,\n    user: \"Emily White\",\n    action: \"updated documentation: API endpoint reference.\",\n    time: \"1 month ago\",\n    dateGroup: \"Older\",\n    unread: false,\n    highlighted: false\n  },\n  {\n    id: 15,\n    user: \"Thomas Anderson\",\n    action: \"deployed new version: v2.3.0 to production.\",\n    time: \"1 month ago\",\n    dateGroup: \"Older\",\n    unread: false,\n    highlighted: false\n  }\n];\n\ntype Notification = (typeof notifications)[number];\n\nfunction groupNotificationsByDate(notifications: Notification[]) {\n  const grouped: Record<string, Notification[]> = {};\n\n  notifications.forEach((notification) => {\n    const dateGroup = notification.dateGroup;\n    if (!grouped[dateGroup]) {\n      grouped[dateGroup] = [];\n    }\n    grouped[dateGroup].push(notification);\n  });\n\n  return grouped;\n}\n\nconst dateGroupOrder = [\"Today\", \"Yesterday\", \"This Week\", \"Last Week\", \"Older\"];\n\nexport default function Example() {\n  const groupedNotifications = groupNotificationsByDate(notifications);\n  const sortedDateGroups = dateGroupOrder.filter((group) => groupedNotifications[group]);\n\n  return (\n    <ScrollArea className=\"h-96 w-full max-w-xs rounded-md border\">\n      <div className=\"space-y-4\">\n        {sortedDateGroups.map((dateGroup) => (\n          <div key={dateGroup} className=\"space-y-1\">\n            <div className=\"bg-background/80 text-muted-foreground sticky top-0 z-0 px-4 py-2 text-xs backdrop-blur-sm\">\n              {dateGroup}\n            </div>\n            {groupedNotifications[dateGroup].map((notification) => (\n              <div\n                key={notification.id}\n                className=\"hover:bg-muted flex items-start gap-4 px-4 py-2.5 transition-colors\">\n                <div className=\"min-w-0 flex-1\">\n                  <p className=\"text-sm leading-snug\">\n                    <span className=\"font-semibold\">{notification.user}</span>{\" \"}\n                    <span className=\"text-foreground\">{notification.action}</span>\n                  </p>\n                  <p className=\"text-muted-foreground mt-1 text-xs\">{notification.time}</p>\n                </div>\n              </div>\n            ))}\n          </div>\n        ))}\n      </div>\n    </ScrollArea>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/scroll-area4.tsx"
    }
  ],
  "type": "registry:component"
}