Skip to content

Commit 2b59cfa

Browse files
refactor: add nice enter animation for notification badge (#17119)
1 parent 5bd2a3f commit 2b59cfa

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Button, type ButtonProps } from "components/Button/Button";
22
import { BellIcon } from "lucide-react";
33
import { forwardRef } from "react";
4+
import { cn } from "utils/cn";
45
import { UnreadBadge } from "./UnreadBadge";
56

67
type InboxButtonProps = {
@@ -21,7 +22,11 @@ export const InboxButton = forwardRef<HTMLButtonElement, InboxButtonProps>(
2122
{unreadCount > 0 && (
2223
<UnreadBadge
2324
count={unreadCount}
24-
className="absolute top-0 right-0 -translate-y-1/2 translate-x-1/2"
25+
className={cn([
26+
"[--offset:calc(var(--unread-badge-size)/2)]",
27+
"absolute top-0 right-0 -mr-[--offset] -mt-[--offset]",
28+
"animate-in fade-in zoom-in duration-200",
29+
])}
2530
/>
2631
)}
2732
</Button>

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ export const UnreadBadge: FC<UnreadBadgeProps> = ({
1313
return (
1414
<span
1515
className={cn([
16-
"flex min-w-[18px] h-[18px] w-fit px-1 rounded text-2xs items-center justify-center",
16+
"[--unread-badge-size:18px] min-w-[--unread-badge-size] h-[--unread-badge-size]",
17+
"flex w-fit px-1 rounded text-2xs items-center justify-center",
1718
"bg-surface-sky text-highlight-sky",
1819
className,
1920
])}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy