feat: make notifications header sticky (#17005)

When having a bunch of notifications and the user is scrolling down the
content it is helpful to keep the header visible so the user can easily
mark all of them as read if they want to.
This commit is contained in:
Bruno Quaresma authored and GitHub committed 2025-03-19 16:02:45 -03:00
1 parent c88d86bf50
commit 4ea5ef925f
2 files changed
+7 -9

No files matched your search

@@ -1,5 +1,5 @@
import type { Meta, StoryObj } from "@storybook/react";
import { expect, fn, userEvent, within } from "@storybook/test";
import { expect, fn, userEvent, waitFor, within } from "@storybook/test";
import { MockNotifications } from "testHelpers/entities";
import { InboxPopover } from "./InboxPopover";
@@ -30,13 +30,6 @@ export const Default: Story = {
},
};
export const Scrollable: Story = {
args: {
unreadCount: 2,
notifications: MockNotifications,
},
};
export const Loading: Story = {
args: {
unreadCount: 0,
@@ -47,7 +47,12 @@ export const InboxPopover: FC<InboxPopoverProps> = ({
* https://github.com/shadcn-ui/ui/issues/542#issuecomment-2339361283
*/}
<ScrollArea className="[&>[data-radix-scroll-area-viewport]]:max-h-[calc(var(--radix-popover-content-available-height)-24px)]">
<div className="flex items-center justify-between p-3 border-0 border-b border-solid border-border">
<div
className={cn([
"flex items-center justify-between p-3 border-0 border-b border-solid border-border",
"sticky top-0 bg-surface-primary z-10 rounded-t",
])}
>
<div className="flex items-center gap-2">
<span className="text-xl font-semibold">Inbox</span>
{unreadCount > 0 && <UnreadBadge count={unreadCount} />}