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.

clean up

Sara Vieira6288397a0612
diff --git a/apps/designer/app/designer/features/workspace/workspace.tsx b/apps/designer/app/designer/features/workspace/workspace.tsx
index 81ec376706..45c558f358 100644
--- a/apps/designer/app/designer/features/workspace/workspace.tsx
+++ b/apps/designer/app/designer/features/workspace/workspace.tsx
@@ -1,9 +1,8 @@
-import { Box, Flex, Toaster } from "@webstudio-is/design-system";
+import { Box, Flex, Toaster, toast } 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,
@@ -46,7 +45,7 @@ export const Workspace = ({
useEffect(() => {
window.setTimeout(() => {
- toast.success("Hiiiii, I am a success toast", {
+ toast.success("Success", {
duration: Infinity,
});
}, 2500);
diff --git a/apps/designer/package.json b/apps/designer/package.json
index 6223e2c8c6..e67d3ce568 100644
--- a/apps/designer/package.json
+++ b/apps/designer/package.json
@@ -54,7 +54,6 @@
"react-dnd-touch-backend": "^15.1.1",
"react-dom": "^17.0.2",
"react-error-boundary": "^3.1.4",
- "react-hot-toast": "^2.3.0",
"react-hotkeys-hook": "^3.4.4",
"react-nano-state": "^0.4.0",
"react-router-dom": "^6.2.2",
diff --git a/packages/design-system/src/components/toast.tsx b/packages/design-system/src/components/toast.tsx
index 02ed497f3d..1c4f638cd4 100644
--- a/packages/design-system/src/components/toast.tsx
+++ b/packages/design-system/src/components/toast.tsx
@@ -1,7 +1,8 @@
import * as ToastPrimitive from "@radix-ui/react-toast";
-import { useToaster } from "react-hot-toast/headless";
+import BaseToast, { useToaster } from "react-hot-toast/headless";
import { keyframes, styled } from "../stitches.config";
import { CheckIcon, Cross1Icon } from "@webstudio-is/icons";
+import { Box } from "./box";
const VIEWPORT_PADDING = "$2";
@@ -40,14 +41,15 @@ const StyledViewport = styled(ToastPrimitive.Viewport, {
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",
+ "$colors$highContrast 0 $2 $6 -$2, $colors$highContrast 0 $2 $4 -$3",
padding: "$3",
display: "flex",
- gap: "$3",
+ gap: "$1",
alignItems: "center",
color: "$highContrast",
fontWeight: 500,
fontSize: "$3",
+ background: "white",
"@media (prefers-reduced-motion: no-preference)": {
'&[data-state="open"]': {
@@ -70,15 +72,12 @@ const StyledToast = styled(ToastPrimitive.Root, {
variants: {
variant: {
error: {
- backgroundColor: "red",
- color: "white",
+ color: "$red11",
},
success: {
- backgroundColor: "green",
- },
- blank: {
- background: "white",
+ color: "$green9",
},
+ blank: {},
custom: {},
loading: {},
},
@@ -92,7 +91,6 @@ const StyledTitle = styled(ToastPrimitive.Title, {
export const Toaster = () => {
const { toasts, handlers } = useToaster();
const { startPause, endPause } = handlers;
- console.log(toasts);
return (
<ToastPrimitive.ToastProvider>
{toasts.map((toast) => (
@@ -102,8 +100,10 @@ export const Toaster = () => {
onMouseEnter={startPause}
onMouseLeave={endPause}
>
- {toast.type === "success" && <CheckIcon />}
- {toast.type === "error" && <Cross1Icon />}
+ <Box>
+ {toast.type === "success" && <CheckIcon />}
+ {toast.type === "error" && <Cross1Icon />}
+ </Box>
<StyledTitle>{toast.message}</StyledTitle>
</StyledToast>
))}
@@ -111,3 +111,5 @@ export const Toaster = () => {
</ToastPrimitive.ToastProvider>
);
};
+
+export const toast = BaseToast;
diff --git a/packages/design-system/src/index.ts b/packages/design-system/src/index.ts
index c563bc6e5e..70c38ab2f7 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 { Toaster } from "./components/toast";
+export { toast, Toaster } from "./components/toast";
export * as Collapsible from "@radix-ui/react-collapsible";
export { AccessibleIcon } from "@radix-ui/react-accessible-icon";