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.

text component variants and use it instead of deprecated one

Oleg Isonena8f54797a928
diff --git a/apps/designer/app/auth/login.tsx b/apps/designer/app/auth/login.tsx
index ce56a22094..9453ee5d47 100644
--- a/apps/designer/app/auth/login.tsx
+++ b/apps/designer/app/auth/login.tsx
@@ -47,7 +47,7 @@ export const Login = ({ errorMessage }: { errorMessage: string }) => {
<Heading size="2">Login</Heading>
<Flex direction="column" gap="4" css={{ width: 300 }}>
{errorMessage.length ? (
- <Text css={{ textAlign: "center", color: "$red10" }}>
+ <Text align="center" color="error">
{errorMessage}
</Text>
) : null}
diff --git a/apps/designer/app/dashboard/components/card.tsx b/apps/designer/app/dashboard/components/card.tsx
index 7dbf9d19c4..2a6e687863 100644
--- a/apps/designer/app/dashboard/components/card.tsx
+++ b/apps/designer/app/dashboard/components/card.tsx
@@ -8,7 +8,7 @@ import {
TextField,
Button,
Heading,
- __DEPRECATED__Text,
+ Text,
} from "@webstudio-is/design-system";
type SelectProjectProjectCardProps = {
@@ -75,9 +75,9 @@ export const SelectProjectCard = ({
</Button>
</Flex>
{errors ? (
- <__DEPRECATED__Text variant="red" css={{ marginTop: "$1" }}>
+ <Text color="error" css={{ marginTop: "$1" }}>
{errors}
- </__DEPRECATED__Text>
+ </Text>
) : null}
</Form>
) : (
diff --git a/apps/designer/app/dashboard/components/header.tsx b/apps/designer/app/dashboard/components/header.tsx
index 4654a215a9..379c29bdc6 100644
--- a/apps/designer/app/dashboard/components/header.tsx
+++ b/apps/designer/app/dashboard/components/header.tsx
@@ -6,7 +6,7 @@ import {
DropdownMenuContent,
DropdownMenuItem,
Button,
- __DEPRECATED__Text,
+ Text,
Flex,
} from "@webstudio-is/design-system";
import { User } from "@webstudio-is/prisma-client";
@@ -45,7 +45,7 @@ export const DashboardHeader = ({ user }: { user: User }) => {
</DropdownMenuTrigger>
<DropdownMenuContent>
<DropdownMenuItem onSelect={() => navigate("/logout")}>
- <__DEPRECATED__Text>Logout</__DEPRECATED__Text>
+ <Text>Logout</Text>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
diff --git a/apps/designer/app/designer/features/breakpoints/breakpoints-editor.tsx b/apps/designer/app/designer/features/breakpoints/breakpoints-editor.tsx
index 096f62e2c8..c172956a12 100644
--- a/apps/designer/app/designer/features/breakpoints/breakpoints-editor.tsx
+++ b/apps/designer/app/designer/features/breakpoints/breakpoints-editor.tsx
@@ -2,12 +2,7 @@ import { useState } from "react";
import useDebounce from "react-use/lib/useDebounce";
import { type Breakpoint } from "@webstudio-is/react-sdk";
import { type Publish } from "~/shared/pubsub";
-import {
- Button,
- TextField,
- Flex,
- __DEPRECATED__Text,
-} from "@webstudio-is/design-system";
+import { Button, TextField, Flex, Text } from "@webstudio-is/design-system";
import { PlusIcon, TrashIcon } from "@webstudio-is/icons";
import ObjectId from "bson-objectid";
import { useBreakpoints } from "~/shared/nano-states";
@@ -108,7 +103,7 @@ export const BreakpointsEditor = ({
justify="between"
css={{ paddingLeft: "$5", paddingRight: "$3", py: "$1" }}
>
- <__DEPRECATED__Text>Breakpoints</__DEPRECATED__Text>
+ <Text>Breakpoints</Text>
<Button
ghost
onClick={() => {
diff --git a/apps/designer/app/designer/features/breakpoints/confirmation-dialog.tsx b/apps/designer/app/designer/features/breakpoints/confirmation-dialog.tsx
index 6862c9f491..619f064420 100644
--- a/apps/designer/app/designer/features/breakpoints/confirmation-dialog.tsx
+++ b/apps/designer/app/designer/features/breakpoints/confirmation-dialog.tsx
@@ -1,5 +1,5 @@
import { type Breakpoint } from "@webstudio-is/react-sdk";
-import { Button, Flex, __DEPRECATED__Text } from "@webstudio-is/design-system";
+import { Button, Flex, Paragraph } from "@webstudio-is/design-system";
type ConfirmationDialogProps = {
onAbort: () => void;
@@ -14,13 +14,11 @@ export const ConfirmationDialog = ({
}: ConfirmationDialogProps) => {
return (
<Flex gap="2" direction="column" css={{ px: "$5", py: "$2", width: 300 }}>
- <__DEPRECATED__Text size="2" css={{ lineHeight: 1.5 }}>
- {`Are you sure you want to delete "${breakpoint.label}"?`}
- </__DEPRECATED__Text>
- <__DEPRECATED__Text size="2" css={{ lineHeight: 1.5 }}>
+ <Paragraph>{`Are you sure you want to delete "${breakpoint.label}"?`}</Paragraph>
+ <Paragraph>
{`Deleting a breakpoint will also delete all styles associated with this
breakpoint.`}
- </__DEPRECATED__Text>
+ </Paragraph>
<Flex justify="end" gap="2">
<Button
onClick={() => {
diff --git a/apps/designer/app/designer/features/breakpoints/preview.tsx b/apps/designer/app/designer/features/breakpoints/preview.tsx
index 5ce338eae3..1a27af9a7f 100644
--- a/apps/designer/app/designer/features/breakpoints/preview.tsx
+++ b/apps/designer/app/designer/features/breakpoints/preview.tsx
@@ -1,9 +1,5 @@
import { type Breakpoint } from "@webstudio-is/react-sdk";
-import {
- Paragraph,
- Flex,
- __DEPRECATED__Text,
-} from "@webstudio-is/design-system";
+import { Paragraph, Flex, Text } from "@webstudio-is/design-system";
type PreviewProps = {
breakpoint?: Breakpoint;
@@ -12,7 +8,7 @@ type PreviewProps = {
export const Preview = ({ breakpoint }: PreviewProps) => {
return (
<Flex css={{ px: "$5", py: "$1" }} gap="1" direction="column">
- <__DEPRECATED__Text size="1">CSS Preview</__DEPRECATED__Text>
+ <Text>CSS Preview</Text>
<Paragraph color="hint">
{breakpoint === undefined
? "No breakpoint selected"
diff --git a/apps/designer/app/designer/features/breakpoints/trigger-button.tsx b/apps/designer/app/designer/features/breakpoints/trigger-button.tsx
index 845d017ddf..1d90e0a401 100644
--- a/apps/designer/app/designer/features/breakpoints/trigger-button.tsx
+++ b/apps/designer/app/designer/features/breakpoints/trigger-button.tsx
@@ -6,7 +6,7 @@ import {
useSelectedBreakpoint,
} from "~/designer/shared/nano-states";
import { willRender } from "~/designer/shared/breakpoints";
-import { Button, __DEPRECATED__Text } from "@webstudio-is/design-system";
+import { Button, Text } from "@webstudio-is/design-system";
import {
DesktopIcon,
LaptopIcon,
@@ -16,8 +16,8 @@ import {
type TriggerButtonProps = ComponentProps<typeof Button>;
-const renderIcon = (breakpoint: Breakpoint, variant: "contrast" | "gray") => {
- const color = variant === "contrast" ? "white" : "gray";
+const renderIcon = (breakpoint: Breakpoint, variant: "contrast" | "hint") => {
+ const color = variant === "contrast" ? "white" : "hint";
if (breakpoint.minWidth >= 1280) {
return <DesktopIcon color={color} />;
}
@@ -38,7 +38,7 @@ export const TriggerButton = forwardRef<
const [breakpoint] = useSelectedBreakpoint();
const [canvasWidth] = useCanvasWidth();
if (breakpoint === undefined) return null;
- const variant = willRender(breakpoint, canvasWidth) ? "contrast" : "gray";
+ const variant = willRender(breakpoint, canvasWidth) ? "contrast" : "hint";
return (
<Button
@@ -49,9 +49,9 @@ export const TriggerButton = forwardRef<
aria-label="Show breakpoints"
>
{renderIcon(breakpoint, variant)}
- <__DEPRECATED__Text size="1" variant={variant}>
+ <Text color={variant}>
{`${breakpoint.label} ${canvasWidth}px / ${zoom}%`}
- </__DEPRECATED__Text>
+ </Text>
</Button>
);
});
diff --git a/apps/designer/app/designer/features/breakpoints/width-setting.tsx b/apps/designer/app/designer/features/breakpoints/width-setting.tsx
index 4d69bab986..0d39eb63dd 100644
--- a/apps/designer/app/designer/features/breakpoints/width-setting.tsx
+++ b/apps/designer/app/designer/features/breakpoints/width-setting.tsx
@@ -3,7 +3,7 @@ import {
useCanvasWidth,
useSelectedBreakpoint,
} from "~/designer/shared/nano-states";
-import { __DEPRECATED__Text, Flex, Slider } from "@webstudio-is/design-system";
+import { Text, Flex, Slider } from "@webstudio-is/design-system";
import { useBreakpoints, useIsPreviewMode } from "~/shared/nano-states";
import { utils } from "@webstudio-is/project";
@@ -54,7 +54,7 @@ export const WidthSetting = () => {
return (
<Flex css={{ px: "$5", py: "$1" }} gap="1" direction="column">
- <__DEPRECATED__Text size="1">Canvas width</__DEPRECATED__Text>
+ <Text>Canvas width</Text>
<Flex gap="3" align="center">
<Slider
min={min}
@@ -64,7 +64,7 @@ export const WidthSetting = () => {
setValue(value);
}}
/>
- <__DEPRECATED__Text size="1">{`${value}px`}</__DEPRECATED__Text>
+ <Text>{`${value}px`}</Text>
</Flex>
</Flex>
);
diff --git a/apps/designer/app/designer/features/breakpoints/zoom-setting.tsx b/apps/designer/app/designer/features/breakpoints/zoom-setting.tsx
index 2d58df997f..449bd30cee 100644
--- a/apps/designer/app/designer/features/breakpoints/zoom-setting.tsx
+++ b/apps/designer/app/designer/features/breakpoints/zoom-setting.tsx
@@ -1,5 +1,5 @@
import { useZoom } from "~/designer/shared/nano-states";
-import { Slider, __DEPRECATED__Text, Flex } from "@webstudio-is/design-system";
+import { Slider, Text, Flex } from "@webstudio-is/design-system";
export const minZoom = 10;
@@ -7,7 +7,7 @@ export const ZoomSetting = () => {
const [value, setValue] = useZoom();
return (
<Flex css={{ px: "$5", py: "$1" }} gap="1" direction="column">
- <__DEPRECATED__Text size="1">Zoom</__DEPRECATED__Text>
+ <Text>Zoom</Text>
<Flex gap="3" align="center">
<Slider
min={minZoom}
@@ -16,7 +16,7 @@ export const ZoomSetting = () => {
setValue(value);
}}
/>
- <__DEPRECATED__Text size="1">{value}%</__DEPRECATED__Text>
+ <Text>{value}%</Text>
</Flex>
</Flex>
);
diff --git a/apps/designer/app/designer/features/props-panel/control.tsx b/apps/designer/app/designer/features/props-panel/control.tsx
index f7259a08c6..299b4340eb 100644
--- a/apps/designer/app/designer/features/props-panel/control.tsx
+++ b/apps/designer/app/designer/features/props-panel/control.tsx
@@ -8,7 +8,7 @@ import {
Select,
Slider,
Switch,
- __DEPRECATED__Text,
+ Text,
TextField,
} from "@webstudio-is/design-system";
import { Checkbox } from "@webstudio-is/design-system";
@@ -137,8 +137,8 @@ const RangeControl = ({
step={step}
/>
<Flex direction="row" justify="between">
- <__DEPRECATED__Text size={1}>{min}</__DEPRECATED__Text>
- <__DEPRECATED__Text size={1}>{max}</__DEPRECATED__Text>
+ <Text>{min}</Text>
+ <Text>{max}</Text>
</Flex>
</Flex>
);
diff --git a/apps/designer/app/designer/features/sidebar-left/panels/components/component-thumb.tsx b/apps/designer/app/designer/features/sidebar-left/panels/components/component-thumb.tsx
index e289e6be41..90f966767b 100644
--- a/apps/designer/app/designer/features/sidebar-left/panels/components/component-thumb.tsx
+++ b/apps/designer/app/designer/features/sidebar-left/panels/components/component-thumb.tsx
@@ -1,6 +1,6 @@
import { type Instance, components } from "@webstudio-is/react-sdk";
import { forwardRef, type ElementRef, type ComponentProps } from "react";
-import { Flex, __DEPRECATED__Text, styled } from "@webstudio-is/design-system";
+import { Flex, Text, styled } from "@webstudio-is/design-system";
const Thumb = styled(Flex, {
px: "$1",
@@ -41,7 +41,7 @@ export const ComponentThumb = forwardRef<
{...rest}
>
<Icon width={30} height={30} />
- <__DEPRECATED__Text size="1">{label}</__DEPRECATED__Text>
+ <Text>{label}</Text>
</Thumb>
);
});
diff --git a/apps/designer/app/designer/features/topbar/menu/shortcut-hint.tsx b/apps/designer/app/designer/features/topbar/menu/shortcut-hint.tsx
index 83a3fa79c1..a7889447dd 100644
--- a/apps/designer/app/designer/features/topbar/menu/shortcut-hint.tsx
+++ b/apps/designer/app/designer/features/topbar/menu/shortcut-hint.tsx
@@ -1,4 +1,4 @@
-import { __DEPRECATED__Text } from "@webstudio-is/design-system";
+import { Text } from "@webstudio-is/design-system";
const isMac =
typeof navigator === "object" ? /mac/i.test(navigator.platform) : false;
@@ -31,9 +31,5 @@ const format = (value: ShortcutDefinition) => {
};
export const ShortcutHint = ({ value }: { value: ShortcutDefinition }) => {
- return (
- <__DEPRECATED__Text size="1" css={{ letterSpacing: 1.5, color: "inherit" }}>
- {format(value)}
- </__DEPRECATED__Text>
- );
+ return <Text css={{ letterSpacing: 1.5 }}>{format(value)}</Text>;
};
diff --git a/apps/designer/app/designer/features/topbar/publish.tsx b/apps/designer/app/designer/features/topbar/publish.tsx
index 1a6d3d3252..8bdced073c 100644
--- a/apps/designer/app/designer/features/topbar/publish.tsx
+++ b/apps/designer/app/designer/features/topbar/publish.tsx
@@ -2,7 +2,7 @@ import { useEffect, useState } from "react";
import { useFetcher } from "@remix-run/react";
import { ExternalLinkIcon, RocketIcon } from "@webstudio-is/icons";
import {
- __DEPRECATED__Text,
+ Text,
Button,
Flex,
Label,
@@ -71,9 +71,7 @@ const Content = ({ project }: PublishButtonProps) => {
<TextField id={id} name="domain" defaultValue={domain} />
</Flex>
{fetcher.data?.errors !== undefined && (
- <__DEPRECATED__Text variant="red">
- {fetcher.data?.errors}
- </__DEPRECATED__Text>
+ <Text color="error">{fetcher.data?.errors}</Text>
)}
{fetcher.state === "idle" ? (
<Button variant="blue" type="submit">
diff --git a/apps/designer/app/designer/shared/inspector/collapsible-section.tsx b/apps/designer/app/designer/shared/inspector/collapsible-section.tsx
index 7afee1d0dd..d94013a2f7 100644
--- a/apps/designer/app/designer/shared/inspector/collapsible-section.tsx
+++ b/apps/designer/app/designer/shared/inspector/collapsible-section.tsx
@@ -54,7 +54,7 @@ export const CollapsibleSection = ({
userSelect: "none",
}}
>
- <Text css={{ fontWeight: "500", flexGrow: 1 }}>{label}</Text>
+ <Text variant="label">{label}</Text>
<Flex
align="center"
justify="center"
diff --git a/packages/design-system/src/components/text.tsx b/packages/design-system/src/components/text.tsx
index ba0e119047..0bf1ee98f0 100644
--- a/packages/design-system/src/components/text.tsx
+++ b/packages/design-system/src/components/text.tsx
@@ -54,6 +54,20 @@ export const Text = styled("div", {
hint: {
color: "$hint",
},
+ error: {
+ color: "$red10",
+ },
+ },
+ align: {
+ left: {
+ textAlign: "left",
+ },
+ center: {
+ textAlign: "center",
+ },
+ right: {
+ textAlign: "right",
+ },
},
truncate: {
true: {