Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

💄 style(toast): align toast radius and offsets with desktop layout container (#18755)

Inneid211afd9a72b
diff --git a/src/features/DesktopLayoutContainer/index.tsx b/src/features/DesktopLayoutContainer/index.tsx
index b7ea4fe6453..80bfb5a5d0c 100644
--- a/src/features/DesktopLayoutContainer/index.tsx
+++ b/src/features/DesktopLayoutContainer/index.tsx
@@ -1,6 +1,6 @@
import { Flexbox } from '@lobehub/ui';
import { type FC, type PropsWithChildren } from 'react';
-import { useMemo, useRef } from 'react';
+import { useEffect, useMemo, useRef } from 'react';
import { useIsDark } from '@/hooks/useIsDark';
import { useGlobalStore } from '@/store/global';
@@ -22,6 +22,20 @@ const DesktopLayoutContainer: FC<PropsWithChildren> = ({ children }) => {
[isDarkMode],
);
+ // Toast viewport is portaled to body, so it can't inherit the container-scoped vars
+ useEffect(() => {
+ const vars: Record<string, string> = {
+ '--toast-border-radius': innerCssVariables['--container-border-radius'],
+ '--toast-viewport-offset-x': '24px',
+ '--toast-viewport-offset-y': '24px',
+ };
+ const root = document.documentElement;
+ for (const [key, value] of Object.entries(vars)) root.style.setProperty(key, value);
+ return () => {
+ for (const key of Object.keys(vars)) root.style.removeProperty(key);
+ };
+ }, [innerCssVariables]);
+
return (
<Flexbox
className={styles.outerContainer}