10000 feat: make notifications header sticky by BrunoQuaresma · Pull Request #17005 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

feat: make notifications header sticky #17005

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { Meta, StoryObj } from "@storybook/react";
import { expect, fn, userEvent, within } from "@storybook/test";
import { MockNotifications } from "testHelpers/entities";
import { InboxPopover } from "./InboxPopover";
import { daysAgo } from "utils/time";

const meta: Meta<typeof InboxPopover> = {
title: "modules/notifications/NotificationsInbox/InboxPopover",
Expand Down Expand Up @@ -32,9 +33,24 @@ export const Default: Story = {

export const Scrollable: Story = {
args: {
unreadCount: 2,
unreadCount: 0,
notifications: MockNotifications,
},
play: async ({ canvasElement }) => {
const body = canvasElement.ownerDocument.body;
const content = body.querySelector<HTMLDivElement>(
"[data-radix-scroll-area-viewport]",
);
if (!content) {
throw new Error("ScrollArea content not found");
}
const openAnimationDuration = 250;
setTimeout(() => {
content.scroll({
top: content?.children[0].clientHeight,
});
}, openAnimationDuration);
},
};

export const Loading: Story = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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} />}
Expand Down
Loading
0