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.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
feat: add visual regression stories for style panel, dashboard, and design system components
Oleg Isonena06bedb8fcaa
diff --git a/apps/builder/app/builder/features/pages/social-preview.stories.tsx b/apps/builder/app/builder/features/pages/social-preview.stories.tsxnew file mode 100644index 0000000000..2ba0465422--- /dev/null+++ b/apps/builder/app/builder/features/pages/social-preview.stories.tsx@@ -0,0 +1,38 @@+import { Box } from "@webstudio-is/design-system";+import { SocialPreview } from "./social-preview";++export default {+ title: "Pages/Social Preview",+ component: SocialPreview,+};++export const WithImage = () => (+ <Box css={{ width: 600, margin: 20 }}>+ <SocialPreview+ ogImageUrl="https://picsum.photos/1200/630"+ ogUrl="https://webstudio.is/blog/architecture-overview"+ ogTitle="Webstudio's Architecture - An Overview"+ ogDescription="This is an introduction for developers who want to contribute to Webstudio Core. However, it may also be an interesting read for ambitious designers."+ />+ </Box>+);++export const WithoutImage = () => (+ <Box css={{ width: 600, margin: 20 }}>+ <SocialPreview+ ogUrl="https://webstudio.is/about"+ ogTitle="About Webstudio"+ ogDescription="A visual development platform for building professional websites without code."+ />+ </Box>+);++export const LongContent = () => (+ <Box css={{ width: 600, margin: 20 }}>+ <SocialPreview+ ogUrl="https://webstudio.is/blog/very-long-url-path/that-should-be-truncated/at-some-point-because-its-too-long"+ ogTitle="This Is a Very Long Title That Should Be Truncated After a Certain Number of Characters to Prevent Layout Issues"+ ogDescription="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."+ />+ </Box>+);diff --git a/apps/builder/app/builder/features/style-panel/sections/backdrop-filter/backdrop-filter.stories.tsx b/apps/builder/app/builder/features/style-panel/sections/backdrop-filter/backdrop-filter.stories.tsxnew file mode 100644index 0000000000..8c15bcc8fd--- /dev/null+++ b/apps/builder/app/builder/features/style-panel/sections/backdrop-filter/backdrop-filter.stories.tsx@@ -0,0 +1,13 @@+import { Box, theme } from "@webstudio-is/design-system";+import { Section } from "./backdrop-filter";++export const BackdropFilters = () => (+ <Box css={{ width: theme.sizes.sidebarWidth }}>+ <Section />+ </Box>+);++export default {+ title: "Style Panel/Backdrop Filters",+ component: Section,+};diff --git a/apps/builder/app/builder/features/style-panel/sections/backgrounds/backgrounds.stories.tsx b/apps/builder/app/builder/features/style-panel/sections/backgrounds/backgrounds.stories.tsxindex b94f5c7ee9..ef898eb06b 100644--- a/apps/builder/app/builder/features/style-panel/sections/backgrounds/backgrounds.stories.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/backgrounds/backgrounds.stories.tsx@@ -1,5 +1,5 @@import { getStyleDeclKey, type StyleDecl } from "@webstudio-is/sdk";-import { styled, theme } from "@webstudio-is/design-system";+import { Box, theme } from "@webstudio-is/design-system";import { registerContainers } from "~/shared/sync/sync-stores";import {$breakpoints,@@ -51,17 +51,11 @@ $awareness.set({instanceSelector: ["box"],});-const Panel = styled("div", {- width: theme.spacing[30],-});--export const Backgrounds = () => {- return (- <Panel>- <Section />- </Panel>- );-};+export const Backgrounds = () => (+ <Box css={{ width: theme.sizes.sidebarWidth }}>+ <Section />+ </Box>+);export default {title: "Style Panel/Backgrounds/Section",diff --git a/apps/builder/app/builder/features/style-panel/sections/borders/borders.stories.tsx b/apps/builder/app/builder/features/style-panel/sections/borders/borders.stories.tsxindex 4708e3fbd3..e5e051a51c 100644--- a/apps/builder/app/builder/features/style-panel/sections/borders/borders.stories.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/borders/borders.stories.tsx@@ -1,18 +1,11 @@-import { styled, theme } from "@webstudio-is/design-system";+import { Box, theme } from "@webstudio-is/design-system";import { Section } from "./borders";-const Panel = styled("div", {- width: theme.spacing[30],- boxSizing: "border-box",-});--export const Borders = () => {- return (- <Panel>- <Section />- </Panel>- );-};+export const Borders = () => (+ <Box css={{ width: theme.sizes.sidebarWidth }}>+ <Section />+ </Box>+);export default {title: "Style Panel/Borders",diff --git a/apps/builder/app/builder/features/style-panel/sections/box-shadows/box-shadows.stories.tsx b/apps/builder/app/builder/features/style-panel/sections/box-shadows/box-shadows.stories.tsxnew file mode 100644index 0000000000..2657bb0f65--- /dev/null+++ b/apps/builder/app/builder/features/style-panel/sections/box-shadows/box-shadows.stories.tsx@@ -0,0 +1,13 @@+import { Box, theme } from "@webstudio-is/design-system";+import { Section } from "./box-shadows";++export const BoxShadows = () => (+ <Box css={{ width: theme.sizes.sidebarWidth }}>+ <Section />+ </Box>+);++export default {+ title: "Style Panel/Box Shadows",+ component: Section,+};diff --git a/apps/builder/app/builder/features/style-panel/sections/filter/filter.stories.tsx b/apps/builder/app/builder/features/style-panel/sections/filter/filter.stories.tsxnew file mode 100644index 0000000000..1dded201d7--- /dev/null+++ b/apps/builder/app/builder/features/style-panel/sections/filter/filter.stories.tsx@@ -0,0 +1,13 @@+import { Box, theme } from "@webstudio-is/design-system";+import { Section } from "./filter";++export const Filters = () => (+ <Box css={{ width: theme.sizes.sidebarWidth }}>+ <Section />+ </Box>+);++export default {+ title: "Style Panel/Filters",+ component: Section,+};diff --git a/apps/builder/app/builder/features/style-panel/sections/flex-child/flex-child.stories.tsx b/apps/builder/app/builder/features/style-panel/sections/flex-child/flex-child.stories.tsxnew file mode 100644index 0000000000..35be714d2f--- /dev/null+++ b/apps/builder/app/builder/features/style-panel/sections/flex-child/flex-child.stories.tsx@@ -0,0 +1,13 @@+import { Box, theme } from "@webstudio-is/design-system";+import { Section } from "./flex-child";++export const FlexChild = () => (+ <Box css={{ width: theme.sizes.sidebarWidth }}>+ <Section />+ </Box>+);++export default {+ title: "Style Panel/Flex Child",+ component: Section,+};diff --git a/apps/builder/app/builder/features/style-panel/sections/grid-child/grid-child.stories.tsx b/apps/builder/app/builder/features/style-panel/sections/grid-child/grid-child.stories.tsxnew file mode 100644index 0000000000..0c7fa8f096--- /dev/null+++ b/apps/builder/app/builder/features/style-panel/sections/grid-child/grid-child.stories.tsx@@ -0,0 +1,13 @@+import { Box, theme } from "@webstudio-is/design-system";+import { Section } from "./grid-child";++export const GridChild = () => (+ <Box css={{ width: theme.sizes.sidebarWidth }}>+ <Section />+ </Box>+);++export default {+ title: "Style Panel/Grid Child",+ component: Section,+};diff --git a/apps/builder/app/builder/features/style-panel/sections/layout/layout.stories.tsx b/apps/builder/app/builder/features/style-panel/sections/layout/layout.stories.tsxnew file mode 100644index 0000000000..fd4209d7e9--- /dev/null+++ b/apps/builder/app/builder/features/style-panel/sections/layout/layout.stories.tsx@@ -0,0 +1,13 @@+import { Box, theme } from "@webstudio-is/design-system";+import { Section } from "./layout";++export const Layout = () => (+ <Box css={{ width: theme.sizes.sidebarWidth }}>+ <Section />+ </Box>+);++export default {+ title: "Style Panel/Layout",+ component: Section,+};diff --git a/apps/builder/app/builder/features/style-panel/sections/layout/shared/alignment-ui.stories.tsx b/apps/builder/app/builder/features/style-panel/sections/layout/shared/alignment-ui.stories.tsxnew file mode 100644index 0000000000..72184222cf--- /dev/null+++ b/apps/builder/app/builder/features/style-panel/sections/layout/shared/alignment-ui.stories.tsx@@ -0,0 +1,87 @@+import { Box, Flex, theme } from "@webstudio-is/design-system";+import { AlignmentUi } from "./alignment-ui";++export default {+ title: "Builder/Style Panel/Layout/Alignment UI",+ component: AlignmentUi,+};++const alignItems = ["start", "center", "end", "stretch", "baseline"];+const justifyContent = [+ "start",+ "center",+ "end",+ "space-between",+ "space-around",+];++export const RowDirection = () => (+ <Box css={{ width: 72, color: theme.colors.foregroundFlexUiMain }}>+ <AlignmentUi+ justifyContent="center"+ alignItems="center"+ isColumnDirection={false}+ color="currentColor"+ itemStretchWidth={false}+ itemStretchHeight={false}+ onSelect={() => {}}+ />+ </Box>+);++export const ColumnDirection = () => (+ <Box css={{ width: 72, color: theme.colors.foregroundFlexUiMain }}>+ <AlignmentUi+ justifyContent="center"+ alignItems="center"+ isColumnDirection={true}+ color="currentColor"+ itemStretchWidth={false}+ itemStretchHeight={false}+ onSelect={() => {}}+ />+ </Box>+);++export const StretchedItems = () => (+ <Box css={{ width: 72, color: theme.colors.foregroundFlexUiMain }}>+ <AlignmentUi+ justifyContent="start"+ alignItems="stretch"+ isColumnDirection={false}+ color="currentColor"+ itemStretchWidth={false}+ itemStretchHeight={true}+ onSelect={() => {}}+ />+ </Box>+);++export const AllCombinations = () => (+ <Flex direction="column" gap="2">+ <Box css={{ fontSize: 10, paddingLeft: 80, fontWeight: "bold" }}>+ justify-content+ </Box>+ {alignItems.map((ai) => (+ <Flex key={ai} gap="2" align="center">+ <Box css={{ fontSize: 10, width: 70, textAlign: "right" }}>{ai}</Box>+ {justifyContent.map((jc) => (+ <Box+ key={jc}+ css={{ width: 72, color: theme.colors.foregroundFlexUiMain }}+ >+ <AlignmentUi+ justifyContent={jc}+ alignItems={ai}+ isColumnDirection={false}+ color="currentColor"+ itemStretchWidth={ai === "stretch"}+ itemStretchHeight={false}+ onSelect={() => {}}+ />+ </Box>+ ))}+ </Flex>+ ))}+ </Flex>+);diff --git a/apps/builder/app/builder/features/style-panel/sections/outline/outline.stories.tsx b/apps/builder/app/builder/features/style-panel/sections/outline/outline.stories.tsxnew file mode 100644index 0000000000..c6a13ce8ee--- /dev/null+++ b/apps/builder/app/builder/features/style-panel/sections/outline/outline.stories.tsx@@ -0,0 +1,13 @@+import { Box, theme } from "@webstudio-is/design-system";+import { Section } from "./outline";++export const Outline = () => (+ <Box css={{ width: theme.sizes.sidebarWidth }}>+ <Section />+ </Box>+);++export default {+ title: "Style Panel/Outline",+ component: Section,+};diff --git a/apps/builder/app/builder/features/style-panel/sections/size/size.stories.tsx b/apps/builder/app/builder/features/style-panel/sections/size/size.stories.tsxnew file mode 100644index 0000000000..e34d016e9d--- /dev/null+++ b/apps/builder/app/builder/features/style-panel/sections/size/size.stories.tsx@@ -0,0 +1,13 @@+import { Box, theme } from "@webstudio-is/design-system";+import { Section } from "./size";++export const Size = () => (+ <Box css={{ width: theme.sizes.sidebarWidth }}>+ <Section />+ </Box>+);++export default {+ title: "Style Panel/Size",+ component: Section,+};diff --git a/apps/builder/app/builder/features/style-panel/sections/text-shadows/text-shadows.stories.tsx b/apps/builder/app/builder/features/style-panel/sections/text-shadows/text-shadows.stories.tsxnew file mode 100644index 0000000000..09870606de--- /dev/null+++ b/apps/builder/app/builder/features/style-panel/sections/text-shadows/text-shadows.stories.tsx@@ -0,0 +1,13 @@+import { Box, theme } from "@webstudio-is/design-system";+import { Section } from "./text-shadows";++export const TextShadows = () => (+ <Box css={{ width: theme.sizes.sidebarWidth }}>+ <Section />+ </Box>+);++export default {+ title: "Style Panel/Text Shadows",+ component: Section,+};diff --git a/apps/builder/app/builder/features/style-panel/sections/transforms/transforms.stories.tsx b/apps/builder/app/builder/features/style-panel/sections/transforms/transforms.stories.tsxnew file mode 100644index 0000000000..dae89ee54c--- /dev/null+++ b/apps/builder/app/builder/features/style-panel/sections/transforms/transforms.stories.tsx@@ -0,0 +1,13 @@+import { Box, theme } from "@webstudio-is/design-system";+import { Section } from "./transforms";++export const Transforms = () => (+ <Box css={{ width: theme.sizes.sidebarWidth }}>+ <Section />+ </Box>+);++export default {+ title: "Style Panel/Transforms",+ component: Section,+};diff --git a/apps/builder/app/builder/features/style-panel/sections/transitions/transitions.stories.tsx b/apps/builder/app/builder/features/style-panel/sections/transitions/transitions.stories.tsxindex e7f1669c70..c685f07e9b 100644--- a/apps/builder/app/builder/features/style-panel/sections/transitions/transitions.stories.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/transitions/transitions.stories.tsx@@ -1,4 +1,4 @@-import { styled, theme } from "@webstudio-is/design-system";+import { Box, theme } from "@webstudio-is/design-system";import { getStyleDeclKey, StyleDecl } from "@webstudio-is/sdk";import {$breakpoints,@@ -13,11 +13,6 @@ import { Section } from "./transitions";import { $awareness } from "~/shared/awareness";import { createDefaultPages } from "@webstudio-is/project-build";-const Panel = styled("div", {- width: theme.spacing[30],- boxShadow: theme.shadows.panelSectionDropShadow,-});-const transitionProperty: StyleDecl = {breakpointId: "base",styleSourceId: "local",@@ -63,13 +58,11 @@ $awareness.set({instanceSelector: ["box"],});-export const Transitions = () => {- return (- <Panel>- <Section />- </Panel>- );-};+export const Transitions = () => (+ <Box css={{ width: theme.sizes.sidebarWidth }}>+ <Section />+ </Box>+);export default {title: "Style Panel/Transitions",diff --git a/apps/builder/app/builder/features/style-panel/sections/typography/typography.stories.tsx b/apps/builder/app/builder/features/style-panel/sections/typography/typography.stories.tsxnew file mode 100644index 0000000000..658eb4e863--- /dev/null+++ b/apps/builder/app/builder/features/style-panel/sections/typography/typography.stories.tsx@@ -0,0 +1,13 @@+import { Box, theme } from "@webstudio-is/design-system";+import { Section } from "./typography";++export const Typography = () => (+ <Box css={{ width: theme.sizes.sidebarWidth }}>+ <Section />+ </Box>+);++export default {+ title: "Style Panel/Typography",+ component: Section,+};diff --git a/apps/builder/app/builder/features/style-panel/shared/show-more.stories.tsx b/apps/builder/app/builder/features/style-panel/shared/show-more.stories.tsxnew file mode 100644index 0000000000..80e52f5775--- /dev/null+++ b/apps/builder/app/builder/features/style-panel/shared/show-more.stories.tsx@@ -0,0 +1,19 @@+import { Text } from "@webstudio-is/design-system";+import { ShowMore } from "./show-more";++export default {+ title: "Builder/Style Panel/Show More",+ component: ShowMore,+};++export const WithItems = () => (+ <ShowMore+ styleConfigs={[+ <Text key="1">First config item</Text>,+ <Text key="2">Second config item</Text>,+ <Text key="3">Third config item</Text>,+ ]}+ />+);++export const Empty = () => <ShowMore styleConfigs={[]} />;diff --git a/apps/builder/app/builder/features/topbar/sync-status.stories.tsx b/apps/builder/app/builder/features/topbar/sync-status.stories.tsxnew file mode 100644index 0000000000..4517615ba5--- /dev/null+++ b/apps/builder/app/builder/features/topbar/sync-status.stories.tsx@@ -0,0 +1,56 @@+import { rawTheme, Flex, theme } from "@webstudio-is/design-system";+import { $queueStatus } from "~/shared/sync/project-queue";+import { SyncStatus } from "./sync-status";++export default {+ title: "Builder/Topbar/Sync Status",+ component: SyncStatus,+};++export const Idle = () => {+ $queueStatus.set({ status: "idle" });+ return (+ <Flex+ css={{+ height: theme.spacing[15],+ background: rawTheme.colors.backgroundPanel,+ padding: theme.spacing[5],+ }}+ >+ <SyncStatus />+ </Flex>+ );+};++export const Failed = () => {+ $queueStatus.set({ status: "failed" });+ return (+ <Flex+ css={{+ height: theme.spacing[15],+ background: rawTheme.colors.backgroundPanel,+ padding: theme.spacing[5],+ }}+ >+ <SyncStatus />+ </Flex>+ );+};++export const Fatal = () => {+ $queueStatus.set({+ status: "fatal",+ error: "Connection lost. Please reload the page.",+ });+ return (+ <Flex+ css={{+ height: theme.spacing[15],+ background: rawTheme.colors.backgroundPanel,+ padding: theme.spacing[5],+ }}+ >+ <SyncStatus />+ </Flex>+ );+};diff --git a/apps/builder/app/builder/features/topbar/view-mode.stories.tsx b/apps/builder/app/builder/features/topbar/view-mode.stories.tsxnew file mode 100644index 0000000000..bea54b2e44--- /dev/null+++ b/apps/builder/app/builder/features/topbar/view-mode.stories.tsx@@ -0,0 +1,38 @@+import { rawTheme, Flex, theme } from "@webstudio-is/design-system";+import { $authPermit } from "~/shared/nano-states";+import { ViewMode } from "./view-mode";++export default {+ title: "Builder/Topbar/View Mode",+ component: ViewMode,+};++export const Active = () => {+ $authPermit.set("view");+ return (+ <Flex+ css={{+ height: theme.spacing[15],+ background: rawTheme.colors.backgroundPanel,+ padding: theme.spacing[5],+ }}+ >+ <ViewMode />+ </Flex>+ );+};++export const Hidden = () => {+ $authPermit.set("edit");+ return (+ <Flex+ css={{+ height: theme.spacing[15],+ background: rawTheme.colors.backgroundPanel,+ padding: theme.spacing[5],+ }}+ >+ <ViewMode />+ </Flex>+ );+};diff --git a/apps/builder/app/dashboard/shared/card.stories.tsx b/apps/builder/app/dashboard/shared/card.stories.tsxnew file mode 100644index 0000000000..c9fba8d25a--- /dev/null+++ b/apps/builder/app/dashboard/shared/card.stories.tsx@@ -0,0 +1,50 @@+import { Text, theme } from "@webstudio-is/design-system";+import { Card, CardContent, CardFooter } from "./card";++export default {+ title: "Builder/Dashboard/Card",+ component: Card,+};++export const Basic = () => (+ <div style={{ width: 280 }}>+ <Card>+ <CardContent+ css={{ background: theme.colors.brandBackgroundProjectCardFront }}+ />+ <CardFooter>+ <Text truncate>My project</Text>+ </CardFooter>+ </Card>+ </div>+);++export const Selected = () => (+ <div style={{ width: 280 }}>+ <Card aria-selected={true}>+ <CardContent+ css={{ background: theme.colors.brandBackgroundProjectCardFront }}+ />+ <CardFooter>+ <Text truncate>Selected project</Text>+ </CardFooter>+ </Card>+ </div>+);++export const Multiple = () => (+ <div style={{ display: "flex", gap: 16, flexWrap: "wrap" }}>+ {["Project Alpha", "My Website", "Landing Page"].map((title) => (+ <div key={title} style={{ width: 280 }}>+ <Card>+ <CardContent+ css={{ background: theme.colors.brandBackgroundProjectCardFront }}+ />+ <CardFooter>+ <Text truncate>{title}</Text>+ </CardFooter>+ </Card>+ </div>+ ))}+ </div>+);diff --git a/apps/builder/app/dashboard/shared/spinner.stories.tsx b/apps/builder/app/dashboard/shared/spinner.stories.tsxnew file mode 100644index 0000000000..be7e0d63fe--- /dev/null+++ b/apps/builder/app/dashboard/shared/spinner.stories.tsx@@ -0,0 +1,18 @@+import { Spinner } from "./spinner";++export default {+ title: "Builder/Dashboard/Spinner",+ component: Spinner,+};++export const Basic = () => (+ <div style={{ position: "relative", width: 400, height: 300 }}>+ <Spinner delay={0} />+ </div>+);++export const SmallSize = () => (+ <div style={{ position: "relative", width: 200, height: 150 }}>+ <Spinner delay={0} size={32} />+ </div>+);diff --git a/apps/builder/app/dashboard/shared/thumbnail.stories.tsx b/apps/builder/app/dashboard/shared/thumbnail.stories.tsxnew file mode 100644index 0000000000..e8a0f0e899--- /dev/null+++ b/apps/builder/app/dashboard/shared/thumbnail.stories.tsx@@ -0,0 +1,50 @@+import { ThumbnailWithAbbr, ThumbnailLinkWithAbbr } from "./thumbnail";++export default {+ title: "Builder/Dashboard/Thumbnail",+};++export const Abbreviation = () => (+ <div+ style={{+ width: 280,+ aspectRatio: "1.91/1",+ display: "flex",+ alignItems: "center",+ justifyContent: "center",+ background: "var(--ws-colors-brand-background-project-card-front)",+ }}+ >+ <ThumbnailWithAbbr title="My Next Project" onClick={() => {}} />+ </div>+);++export const AbbreviationLink = () => (+ <div+ style={{+ width: 280,+ aspectRatio: "1.91/1",+ display: "flex",+ alignItems: "center",+ justifyContent: "center",+ background: "var(--ws-colors-brand-background-project-card-front)",+ }}+ >+ <ThumbnailLinkWithAbbr title="Landing Page" to="#" />+ </div>+);++export const SingleWord = () => (+ <div+ style={{+ width: 280,+ aspectRatio: "1.91/1",+ display: "flex",+ alignItems: "center",+ justifyContent: "center",+ background: "var(--ws-colors-brand-background-project-card-front)",+ }}+ >+ <ThumbnailWithAbbr title="Portfolio" onClick={() => {}} />+ </div>+);diff --git a/apps/builder/app/shared/copy-to-clipboard.stories.tsx b/apps/builder/app/shared/copy-to-clipboard.stories.tsxnew file mode 100644index 0000000000..3ab6e220c7--- /dev/null+++ b/apps/builder/app/shared/copy-to-clipboard.stories.tsx@@ -0,0 +1,23 @@+import { Button } from "@webstudio-is/design-system";+import { CopyToClipboard } from "./copy-to-clipboard";++export default {+ title: "Builder/Copy To Clipboard",+ component: CopyToClipboard,+};++export const Basic = () => (+ <CopyToClipboard text="Hello, world!">+ <Button>Click to copy</Button>+ </CopyToClipboard>+);++export const CustomLabels = () => (+ <CopyToClipboard+ text="some-secret-token-123"+ copyText="Copy token"+ copiedText="Token copied!"+ >+ <Button>Copy token</Button>+ </CopyToClipboard>+);diff --git a/apps/builder/app/shared/error/error-message.stories.tsx b/apps/builder/app/shared/error/error-message.stories.tsxnew file mode 100644index 0000000000..fccf693c3f--- /dev/null+++ b/apps/builder/app/shared/error/error-message.stories.tsx@@ -0,0 +1,38 @@+import { ErrorMessage } from "./error-message.client";++export default {+ title: "Builder/Error Message",+ component: ErrorMessage,+};++export const NotFound = () => (+ <ErrorMessage+ error={{+ status: 404,+ statusText: "Not Found",+ message: "The page you're looking for doesn't exist.",+ }}+ />+);++export const ServerError = () => (+ <ErrorMessage+ error={{+ status: 500,+ statusText: "Internal Server Error",+ message: "Something went wrong on our end.",+ description:+ "Please try again later or contact support if the problem persists.",+ }}+ />+);++export const Forbidden = () => (+ <ErrorMessage+ error={{+ status: 403,+ statusText: "Forbidden",+ message: "You don't have permission to access this resource.",+ }}+ />+);diff --git a/packages/design-system/src/components/avatar.stories.tsx b/packages/design-system/src/components/avatar.stories.tsxnew file mode 100644index 0000000000..fcdd8b3355--- /dev/null+++ b/packages/design-system/src/components/avatar.stories.tsx@@ -0,0 +1,27 @@+import { Flex } from "./flex";+import { Avatar } from "./avatar";++export default {+ title: "Design System/Avatar",+ component: Avatar,+};++export const WithImage = () => (+ <Flex gap="3" align="center">+ <Avatar+ src="https://i.pravatar.cc/150?u=avatar1"+ alt="User avatar"+ fallback="JD"+ />+ </Flex>+);++export const WithFallback = () => (+ <Flex gap="3" align="center">+ <Avatar fallback="JD" />+ <Avatar fallback="AB" />+ <Avatar fallback="WS" />+ </Flex>+);++export const NoImageNoFallback = () => <Avatar />;diff --git a/packages/design-system/src/components/card.stories.tsx b/packages/design-system/src/components/card.stories.tsxnew file mode 100644index 0000000000..ba8f5bf8b5--- /dev/null+++ b/packages/design-system/src/components/card.stories.tsx@@ -0,0 +1,19 @@+import { Text } from "./text";+import { Card } from "./card";++export default {+ title: "Design System/Card",+ component: Card,+};++export const Default = () => (+ <Card>+ <Text>Card content goes here</Text>+ </Card>+);++export const Size1 = () => (+ <Card size="1">+ <Text>Card with size 1</Text>+ </Card>+);diff --git a/packages/design-system/src/components/dropdown-menu.stories.tsx b/packages/design-system/src/components/dropdown-menu.stories.tsxnew file mode 100644index 0000000000..411756b607--- /dev/null+++ b/packages/design-system/src/components/dropdown-menu.stories.tsx@@ -0,0 +1,61 @@+import { useState } from "react";+import { Box } from "./box";+import { Button } from "./button";+import {+ DropdownMenu,+ DropdownMenuTrigger,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuSeparator,+ DropdownMenuCheckboxItem,+} from "./dropdown-menu";++export default {+ title: "Design System/Dropdown Menu",+};++export const Basic = () => {+ const [open, setOpen] = useState(true);+ return (+ <Box css={{ padding: 100 }}>+ <DropdownMenu open={open} onOpenChange={setOpen}>+ <DropdownMenuTrigger asChild>+ <Button>Open menu</Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent>+ <DropdownMenuItem>New file</DropdownMenuItem>+ <DropdownMenuItem>Open project</DropdownMenuItem>+ <DropdownMenuSeparator />+ <DropdownMenuItem>Settings</DropdownMenuItem>+ <DropdownMenuItem disabled>Disabled item</DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ </Box>+ );+};++export const WithCheckboxItems = () => {+ const [bold, setBold] = useState(true);+ const [italic, setItalic] = useState(false);+ const [open, setOpen] = useState(true);+ return (+ <Box css={{ padding: 100 }}>+ <DropdownMenu open={open} onOpenChange={setOpen}>+ <DropdownMenuTrigger asChild>+ <Button>Text formatting</Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent>+ <DropdownMenuCheckboxItem checked={bold} onCheckedChange={setBold}>+ Bold+ </DropdownMenuCheckboxItem>+ <DropdownMenuCheckboxItem+ checked={italic}+ onCheckedChange={setItalic}+ >+ Italic+ </DropdownMenuCheckboxItem>+ </DropdownMenuContent>+ </DropdownMenu>+ </Box>+ );+};diff --git a/packages/design-system/src/components/primitives/small-button.stories.tsx b/packages/design-system/src/components/primitives/small-button.stories.tsxnew file mode 100644index 0000000000..7ab9321028--- /dev/null+++ b/packages/design-system/src/components/primitives/small-button.stories.tsx@@ -0,0 +1,70 @@+import { Flex } from "../flex";+import { XSmallIcon, TrashIcon, PlusIcon } from "@webstudio-is/icons";+import { SmallButton } from "./small-button";++export default {+ title: "Design System/Primitives/Small Button",+ component: SmallButton,+};++export const Normal = () => (+ <Flex gap="5" align="center">+ <SmallButton>+ <XSmallIcon />+ </SmallButton>+ <SmallButton>+ <PlusIcon />+ </SmallButton>+ <SmallButton disabled>+ <XSmallIcon />+ </SmallButton>+ </Flex>+);++export const Destructive = () => (+ <Flex gap="5" align="center">+ <SmallButton variant="destructive">+ <TrashIcon />+ </SmallButton>+ <SmallButton variant="destructive" disabled>+ <TrashIcon />+ </SmallButton>+ </Flex>+);++export const Contrast = () => (+ <Flex+ gap="5"+ align="center"+ css={{ background: "#333", padding: 16, borderRadius: 8 }}+ >+ <SmallButton variant="contrast">+ <XSmallIcon />+ </SmallButton>+ <SmallButton variant="contrast" disabled>+ <XSmallIcon />+ </SmallButton>+ </Flex>+);++export const AllVariants = () => (+ <Flex direction="column" gap="5">+ <Flex gap="5" align="center">+ <SmallButton variant="normal">+ <XSmallIcon />+ </SmallButton>+ <SmallButton variant="destructive">+ <TrashIcon />+ </SmallButton>+ </Flex>+ <Flex+ gap="5"+ align="center"+ css={{ background: "#333", padding: 16, borderRadius: 8 }}+ >+ <SmallButton variant="contrast">+ <XSmallIcon />+ </SmallButton>+ </Flex>+ </Flex>+);diff --git a/packages/design-system/src/components/pro-badge.stories.tsx b/packages/design-system/src/components/pro-badge.stories.tsxnew file mode 100644index 0000000000..4489469b15--- /dev/null+++ b/packages/design-system/src/components/pro-badge.stories.tsx@@ -0,0 +1,17 @@+import { Flex } from "./flex";+import { ProBadge } from "./pro-badge";++export default {+ title: "Design System/ProBadge",+ component: ProBadge,+};++export const Default = () => <ProBadge>Pro</ProBadge>;++export const CustomText = () => (+ <Flex gap="3" align="center">+ <ProBadge>Pro</ProBadge>+ <ProBadge>Enterprise</ProBadge>+ <ProBadge>Upgrade</ProBadge>+ </Flex>+);diff --git a/packages/design-system/src/components/progress.stories.tsx b/packages/design-system/src/components/progress.stories.tsxnew file mode 100644index 0000000000..0f3fbc3d75--- /dev/null+++ b/packages/design-system/src/components/progress.stories.tsx@@ -0,0 +1,38 @@+import { useState } from "react";+import { Flex } from "./flex";+import { Button } from "./button";+import { Progress } from "./progress";++export default {+ title: "Design System/Progress",+ component: Progress,+};++export const Default = () => <Progress value={50} />;++export const Empty = () => <Progress value={0} />;++export const Full = () => <Progress value={100} />;++export const Steps = () => (+ <Flex direction="column" gap="5">+ <Progress value={0} />+ <Progress value={25} />+ <Progress value={50} />+ <Progress value={75} />+ <Progress value={100} />+ </Flex>+);++export const Interactive = () => {+ const [value, setValue] = useState(30);+ return (+ <Flex direction="column" gap="5" align="start">+ <Progress value={value} />+ <Flex gap="3">+ <Button onClick={() => setValue(Math.max(0, value - 10))}>-10</Button>+ <Button onClick={() => setValue(Math.min(100, value + 10))}>+10</Button>+ </Flex>+ </Flex>+ );+};