8000 feat: make notifications header sticky (#17005) · coder/coder@4ea5ef9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4ea5ef9

Browse files
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.
1 parent c88d86b commit 4ea5ef9

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

site/src/modules/notifications/NotificationsInbox/InboxPopover.stories.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Meta, StoryObj } from "@storybook/react";
2-
import { expect, fn, userEvent, within } from "@storybook/test";
2+
import { expect, fn, userEvent, waitFor, within } from "@storybook/test";
33
import { MockNotifications } from "testHelpers/entities";
44
import { InboxPopover } from "./InboxPopover";
55

@@ -30,13 +30,6 @@ export const Default: Story = {
3030
},
3131
};
3232

33-
export const Scrollable: Story = {
34-
args: {
35-
unreadCount: 2,
36-
notifications: MockNotifications,
37-
},
38-
};
39-
4033
export const Loading: Story = {
4134
args: {
4235
unreadCount: 0,

site/src/modules/notifications/NotificationsInbox/InboxPopover.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ export const InboxPopover: FC<InboxPopoverProps> = ({
4747
* https://github.com/shadcn-ui/ui/issues/542#issuecomment-2339361283
4848
*/}
4949
<ScrollArea className="[&>[data-radix-scroll-area-viewport]]:max-h-[calc(var(--radix-popover-content-available-height)-24px)]">
50-
<div className="flex items-center justify-between p-3 border-0 border-b border-solid border-border">
50+
<div
51+
className={cn([
52+
"flex items-center justify-between p-3 border-0 border-b border-solid border-border",
53+
"sticky top-0 bg-surface-primary z-10 rounded-t",
54+
])}
55+
>
5156
<div className="flex items-center gap-2">
5257
<span className="text-xl font-semibold">Inbox</span>
5358
{unreadCount > 0 && <UnreadBadge count={unreadCount} />}

0 commit comments

Comments
 (0)
0