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.

Add semantic colors for background and text and use them globally in the Storybook

Andrey Okonetchnikovd236604b331e
diff --git a/.storybook/preview.js b/.storybook/preview.js
deleted file mode 100644
index 48afd568ae..0000000000
--- a/.storybook/preview.js
+++ /dev/null
@@ -1,9 +0,0 @@
-export const parameters = {
- actions: { argTypesRegex: "^on[A-Z].*" },
- controls: {
- matchers: {
- color: /(background|color)$/i,
- date: /Date$/,
- },
- },
-}
\ No newline at end of file
diff --git a/.storybook/preview.tsx b/.storybook/preview.tsx
new file mode 100644
index 0000000000..eeb7f83828
--- /dev/null
+++ b/.storybook/preview.tsx
@@ -0,0 +1,27 @@
+import React from "react";
+import { darkTheme, globalCss } from "~/shared/design-system";
+
+export const parameters = {
+ actions: { argTypesRegex: "^on[A-Z].*" },
+ controls: {
+ matchers: {
+ color: /(background|color)$/i,
+ date: /Date$/,
+ },
+ },
+};
+
+const globalStyles = globalCss({
+ body: {
+ backgroundColor: "$background",
+ color: "$text",
+ },
+});
+
+export const decorators = [
+ (StoryFn: any) => {
+ document.body.classList.add(darkTheme);
+ globalStyles();
+ return <StoryFn />;
+ },
+];
diff --git a/app/shared/design-system/stitches.config.ts b/app/shared/design-system/stitches.config.ts
index 1a934774e4..5274768da6 100644
--- a/app/shared/design-system/stitches.config.ts
+++ b/app/shared/design-system/stitches.config.ts
@@ -491,6 +491,8 @@ export const darkTheme = createTheme("dark-theme", {
...goldDarkA,
// Semantic colors
+ background: "$slate1",
+ text: "$slate12",
hiContrast: "$slate12",
loContrast: "$slate1",
canvas: "hsl(0 0% 15%)",