diff --git a/www/apps/book/components/Homepage/LinksSection/index.tsx b/www/apps/book/components/Homepage/LinksSection/index.tsx index 34700fd27e..dc0dce5f56 100644 --- a/www/apps/book/components/Homepage/LinksSection/index.tsx +++ b/www/apps/book/components/Homepage/LinksSection/index.tsx @@ -84,7 +84,12 @@ const Section = ({ title, links }: SectionProps) => {

{title}

{links.map((link, index) => ( - + {link.text} ))} diff --git a/www/apps/book/providers/index.tsx b/www/apps/book/providers/index.tsx index e157fd811d..17bdd196e2 100644 --- a/www/apps/book/providers/index.tsx +++ b/www/apps/book/providers/index.tsx @@ -32,7 +32,7 @@ const Providers = ({ children }: ProvidersProps) => { {children} diff --git a/www/packages/docs-ui/src/components/Card/Layout/Default/index.tsx b/www/packages/docs-ui/src/components/Card/Layout/Default/index.tsx index c84b95d82b..02d0842934 100644 --- a/www/packages/docs-ui/src/components/Card/Layout/Default/index.tsx +++ b/www/packages/docs-ui/src/components/Card/Layout/Default/index.tsx @@ -68,6 +68,7 @@ export const CardDefaultLayout = ({ )}
diff --git a/www/packages/docs-ui/src/components/Card/Layout/Large/index.tsx b/www/packages/docs-ui/src/components/Card/Layout/Large/index.tsx index c06759a202..eb0b3ef8d8 100644 --- a/www/packages/docs-ui/src/components/Card/Layout/Large/index.tsx +++ b/www/packages/docs-ui/src/components/Card/Layout/Large/index.tsx @@ -61,6 +61,7 @@ export const CardLargeLayout = ({ )} diff --git a/www/packages/docs-ui/src/components/Card/Layout/Mini/index.tsx b/www/packages/docs-ui/src/components/Card/Layout/Mini/index.tsx index 28a7384f6e..0a9be2c11c 100644 --- a/www/packages/docs-ui/src/components/Card/Layout/Mini/index.tsx +++ b/www/packages/docs-ui/src/components/Card/Layout/Mini/index.tsx @@ -89,7 +89,11 @@ export const CardLayoutMini = ({ {isExternal ? : } {href && ( - + )} diff --git a/www/packages/docs-ui/src/components/Notification/Item/index.tsx b/www/packages/docs-ui/src/components/Notification/Item/index.tsx index 4e328319aa..78a8c0a6c7 100644 --- a/www/packages/docs-ui/src/components/Notification/Item/index.tsx +++ b/www/packages/docs-ui/src/components/Notification/Item/index.tsx @@ -1,6 +1,10 @@ +"use client" + import clsx from "clsx" -import React, { Children, ReactElement } from "react" +import React, { Children, ReactElement, useRef } from "react" import { NotificationItemLayoutDefault } from "./Layout/Default" +// @ts-expect-error can't install the types package because it doesn't support React v19 +import { CSSTransition } from "react-transition-group" export type NotificationItemProps = { layout?: "default" | "empty" @@ -16,65 +20,70 @@ export type NotificationItemProps = { setShow?: (value: boolean) => void onClose?: () => void closeButtonText?: string + passRef?: React.RefObject } & React.HTMLAttributes type EmptyLayoutProps = { onClose?: () => void } -export const NotificationItem = React.forwardRef< - HTMLDivElement, - NotificationItemProps ->(function NotificationItem( - { - className = "", - placement = "bottom", - show = true, - layout = "default", - setShow, - onClose, - children, - ...rest - }, - ref -) { +export const NotificationItem = ({ + className = "", + placement = "bottom", + show = true, + layout = "default", + setShow, + onClose, + children, + ...rest +}: NotificationItemProps) => { + const ref = useRef(null) const handleClose = () => { setShow?.(false) onClose?.() } return ( -
- {layout === "default" && ( - - {children} - - )} - {layout === "empty" && - Children.map(children, (child) => { - if (child) { - return React.cloneElement( - child as React.ReactElement< - EmptyLayoutProps, - React.FunctionComponent - >, - { - onClose: handleClose, - } - ) - } - })} -
+
+ {layout === "default" && ( + + {children} + + )} + {layout === "empty" && + Children.map(children, (child) => { + if (child) { + return React.cloneElement( + child as React.ReactElement< + EmptyLayoutProps, + React.FunctionComponent + >, + { + onClose: handleClose, + } + ) + } + })} +
+ ) -}) +} diff --git a/www/packages/docs-ui/src/components/Notification/index.tsx b/www/packages/docs-ui/src/components/Notification/index.tsx index 509a60af4c..6f3770dedd 100644 --- a/www/packages/docs-ui/src/components/Notification/index.tsx +++ b/www/packages/docs-ui/src/components/Notification/index.tsx @@ -5,25 +5,16 @@ import { NotificationItemType, useNotifications, } from "@/providers" -import React, { useEffect, useRef } from "react" +import React from "react" import { NotificationItem } from "./Item" // @ts-expect-error can't install the types package because it doesn't support React v19 -import { CSSTransition, TransitionGroup } from "react-transition-group" +import { TransitionGroup } from "react-transition-group" import clsx from "clsx" export const NotificationContainer = () => { const { notifications, removeNotification } = useNotifications() as NotificationContextType - const notificationRefs = useRef([]) - - useEffect(() => { - notificationRefs.current = notificationRefs.current.slice( - 0, - notifications.length - ) - }, [notifications]) - const handleClose = (notification: NotificationItemType) => { notification.onClose?.() if (notification.id) { @@ -45,26 +36,16 @@ export const NotificationContainer = () => { className )} > - {notifications.filter(condition).map((notification, index) => ( - ( + handleClose(notification)} + className={clsx( + notification.className, + "!relative !top-0 !bottom-0 !right-0" + )} key={notification.id} - timeout={200} - classNames={{ - enter: "animate-slideInRight animate-fast", - exit: "animate-slideOutRight animate-fast", - }} - nodeRef={notificationRefs.current[index]} - > - handleClose(notification)} - ref={notificationRefs.current[index]} - className={clsx( - notification.className, - "!relative !top-0 !bottom-0 !right-0" - )} - /> - + /> ))} )