Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

rename

Sara Vieira3056c9532c51
diff --git a/apps/designer/app/designer/designer.tsx b/apps/designer/app/designer/designer.tsx
index 18c939efe8..26c17be585 100644
--- a/apps/designer/app/designer/designer.tsx
+++ b/apps/designer/app/designer/designer.tsx
@@ -1,4 +1,4 @@
-import { useCallback, useEffect, useState } from "react";
+import { useCallback, useState } from "react";
import { DndProvider } from "react-dnd";
import { TouchBackend } from "react-dnd-touch-backend";
import { useSubscribe, usePublish } from "@webstudio-is/react-sdk";
@@ -34,7 +34,6 @@ import { usePublishShortcuts } from "./shared/shortcuts";
import { type SyncStatus } from "~/shared/sync";
import { useIsPreviewMode, useRootInstance } from "~/shared/nano-states";
import { useSubscribeClientSetting } from "./shared/client-settings";
-import toast from "react-hot-toast/headless";
export const links = () => {
return [
@@ -200,18 +199,6 @@ export const Designer = ({ config, project, assets }: DesignerProps) => {
[publishRef, onRefReadCanvasWidth, onRefReadCanvas]
);
- useEffect(() => {
- window.setTimeout(() => {
- toast.success("Hiiiii, I am a success toast");
- }, 2500);
- window.setTimeout(() => {
- toast.error("Hi am an error");
- }, 3000);
- window.setTimeout(() => {
- toast("Hi I am a message");
- }, 3500);
- }, []);
-
return (
<DndProvider backend={TouchBackend} options={dndOptions}>
<ChromeWrapper isPreviewMode={isPreviewMode}>
diff --git a/apps/designer/app/designer/features/workspace/canvas-tools/canvas-tools.tsx b/apps/designer/app/designer/features/workspace/canvas-tools/canvas-tools.tsx
index d4d9d1cf13..ac6b121874 100644
--- a/apps/designer/app/designer/features/workspace/canvas-tools/canvas-tools.tsx
+++ b/apps/designer/app/designer/features/workspace/canvas-tools/canvas-tools.tsx
@@ -36,6 +36,7 @@ export const CanvasTools = ({ publish }: CanvasToolsProps) => {
if (isPreviewMode || isScrolling) {
return null;
}
+
return (
<Box css={toolsStyle}>
<SelectedInstanceOutline />
diff --git a/apps/designer/app/designer/features/workspace/workspace.tsx b/apps/designer/app/designer/features/workspace/workspace.tsx
index f1e803b2c0..81ec376706 100644
--- a/apps/designer/app/designer/features/workspace/workspace.tsx
+++ b/apps/designer/app/designer/features/workspace/workspace.tsx
@@ -1,7 +1,9 @@
-import { Box, Flex, Notifications } from "@webstudio-is/design-system";
+import { Box, Flex, Toaster } from "@webstudio-is/design-system";
import { useCanvasWidth, useZoom } from "~/designer/shared/nano-states";
import { CanvasTools } from "./canvas-tools";
import { type Publish } from "@webstudio-is/react-sdk";
+import { useEffect } from "react";
+import toast from "react-hot-toast/headless";
const workspaceStyle = {
flexGrow: 1,
@@ -42,6 +44,20 @@ export const Workspace = ({
publish<"unselectInstance">({ type: "unselectInstance" });
};
+ useEffect(() => {
+ window.setTimeout(() => {
+ toast.success("Hiiiii, I am a success toast", {
+ duration: Infinity,
+ });
+ }, 2500);
+ window.setTimeout(() => {
+ toast.error("Hi am an error");
+ }, 3000);
+ window.setTimeout(() => {
+ toast("Hi I am a message");
+ }, 3500);
+ }, []);
+
return (
<Box css={workspaceStyle} onClick={handleWorkspaceClick}>
<Flex
@@ -56,7 +72,7 @@ export const Workspace = ({
<CanvasTools publish={publish} />
</Box>
</Flex>
- <Notifications />
+ <Toaster />
</Box>
);
};
diff --git a/packages/design-system/src/components/toast.tsx b/packages/design-system/src/components/toast.tsx
index 77dae9638a..02ed497f3d 100644
--- a/packages/design-system/src/components/toast.tsx
+++ b/packages/design-system/src/components/toast.tsx
@@ -1,11 +1,9 @@
-import { styled } from "@stitches/react";
-import { slate } from "@radix-ui/colors";
import * as ToastPrimitive from "@radix-ui/react-toast";
import { useToaster } from "react-hot-toast/headless";
-import { keyframes } from "../stitches.config";
+import { keyframes, styled } from "../stitches.config";
import { CheckIcon, Cross1Icon } from "@webstudio-is/icons";
-const VIEWPORT_PADDING = 10;
+const VIEWPORT_PADDING = "$2";
const hide = keyframes({
"0%": { opacity: 1 },
@@ -35,7 +33,7 @@ const StyledViewport = styled(ToastPrimitive.Viewport, {
maxWidth: "100vw",
margin: 0,
listStyle: "none",
- zIndex: 2147483649,
+ zIndex: "$max",
outline: "none",
});
@@ -43,13 +41,13 @@ const StyledToast = styled(ToastPrimitive.Root, {
borderRadius: 6,
boxShadow:
"hsl(206 22% 7% / 35%) 0px 10px 38px -10px, hsl(206 22% 7% / 20%) 0px 10px 20px -15px",
- padding: 15,
+ padding: "$3",
display: "flex",
- gap: 15,
+ gap: "$3",
alignItems: "center",
- color: slate.slate12,
+ color: "$highContrast",
fontWeight: 500,
- fontSize: 15,
+ fontSize: "$3",
"@media (prefers-reduced-motion: no-preference)": {
'&[data-state="open"]': {
@@ -88,13 +86,13 @@ const StyledToast = styled(ToastPrimitive.Root, {
});
const StyledTitle = styled(ToastPrimitive.Title, {
- marginBottom: 5,
+ marginBottom: "$1",
});
-export const Notifications = () => {
+export const Toaster = () => {
const { toasts, handlers } = useToaster();
const { startPause, endPause } = handlers;
-
+ console.log(toasts);
return (
<ToastPrimitive.ToastProvider>
{toasts.map((toast) => (
diff --git a/packages/design-system/src/index.ts b/packages/design-system/src/index.ts
index 3788a741d5..c563bc6e5e 100644
--- a/packages/design-system/src/index.ts
+++ b/packages/design-system/src/index.ts
@@ -11,7 +11,7 @@ export {
theme,
type CSS,
} from "./stitches.config";
-export { Notifications } from "./components/toast";
+export { Toaster } from "./components/toast";
export * as Collapsible from "@radix-ui/react-collapsible";
export { AccessibleIcon } from "@radix-ui/react-accessible-icon";