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.

migrate paragraph component to the new Text component, add hint color a semantic color

Oleg Isonen9c6523cecd6b
diff --git a/apps/designer/app/designer/features/breakpoints/preview.tsx b/apps/designer/app/designer/features/breakpoints/preview.tsx
index f8c7a6ce9e..5ce338eae3 100644
--- a/apps/designer/app/designer/features/breakpoints/preview.tsx
+++ b/apps/designer/app/designer/features/breakpoints/preview.tsx
@@ -13,7 +13,7 @@ export const Preview = ({ breakpoint }: PreviewProps) => {
return (
<Flex css={{ px: "$5", py: "$1" }} gap="1" direction="column">
<__DEPRECATED__Text size="1">CSS Preview</__DEPRECATED__Text>
- <Paragraph css={{ fontSize: "$1" }} variant="gray">
+ <Paragraph color="hint">
{breakpoint === undefined
? "No breakpoint selected"
: `@media (min-width: ${breakpoint.minWidth}px)`}
diff --git a/packages/design-system/src/components/paragraph.tsx b/packages/design-system/src/components/paragraph.tsx
index ac65337f42..45af7916e8 100644
--- a/packages/design-system/src/components/paragraph.tsx
+++ b/packages/design-system/src/components/paragraph.tsx
@@ -1,49 +1,23 @@
-import React from "react";
-import { __DEPRECATED__Text } from "./__DEPRECATED__/text";
-import { VariantProps, CSS } from "../stitches.config";
-import merge from "lodash.merge";
+import React, { type ComponentProps } from "react";
+import { Text } from "./text";
const DEFAULT_TAG = "p";
-type TextSizeVariants = Pick<VariantProps<typeof __DEPRECATED__Text>, "size">;
-type ParagraphSizeVariants = "1" | "2";
-type ParagraphVariants = { size?: ParagraphSizeVariants } & Omit<
- VariantProps<typeof __DEPRECATED__Text>,
- "size"
->;
-type ParagraphProps = React.ComponentProps<typeof DEFAULT_TAG> &
- ParagraphVariants & { css?: CSS; as?: string };
+type ParagraphProps = ComponentProps<typeof DEFAULT_TAG> &
+ ComponentProps<typeof Text>;
export const Paragraph = React.forwardRef<
React.ElementRef<typeof DEFAULT_TAG>,
ParagraphProps
->((props, forwardedRef) => {
- // '2' here is the default Paragraph size variant
- const { size = "1", ...textProps } = props;
-
- // This is the mapping of Paragraph Variants to Text variants
- const textSize: Record<ParagraphSizeVariants, TextSizeVariants["size"]> = {
- 1: { "@initial": "2", "@bp2": "4" },
- 2: { "@initial": "5", "@bp2": "6" },
- };
-
- // This is the mapping of Paragraph Variants to Text css
- const textCss: Record<ParagraphSizeVariants, CSS> = {
- 1: { lineHeight: "25px", "@bp2": { lineHeight: "27px" } },
- 2: {
- color: "$slate11",
- lineHeight: "27px",
- "@bp2": { lineHeight: "30px" },
- },
- };
+>(({ css, ...props }, forwardedRef) => {
return (
- <__DEPRECATED__Text
+ <Text
as={DEFAULT_TAG}
- {...textProps}
+ {...props}
ref={forwardedRef}
- size={textSize[size]}
css={{
- ...merge(textCss[size], props.css),
+ lineHeight: 1.3,
+ ...css,
}}
/>
);
diff --git a/packages/design-system/src/components/text.tsx b/packages/design-system/src/components/text.tsx
index 5079353222..ba0e119047 100644
--- a/packages/design-system/src/components/text.tsx
+++ b/packages/design-system/src/components/text.tsx
@@ -51,6 +51,9 @@ export const Text = styled("div", {
loContrast: {
color: "$loContrast",
},
+ hint: {
+ color: "$hint",
+ },
},
truncate: {
true: {
diff --git a/packages/design-system/src/components/tooltip.tsx b/packages/design-system/src/components/tooltip.tsx
index 0282377e85..211036ad3e 100644
--- a/packages/design-system/src/components/tooltip.tsx
+++ b/packages/design-system/src/components/tooltip.tsx
@@ -2,7 +2,7 @@ import React, { Ref } from "react";
import { styled } from "../stitches.config";
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
import { Box } from "./box";
-import { __DEPRECATED__Text } from "./__DEPRECATED__/text";
+import { Paragraph } from "./paragraph";
import type { CSS } from "../stitches.config";
type TooltipProps = React.ComponentProps<typeof TooltipPrimitive.Root> &
@@ -20,7 +20,7 @@ const Content = styled(TooltipPrimitive.Content, {
color: "$loContrast",
borderRadius: "$1",
padding: "$1 $2",
- zIndex: "$max",
+ zIndex: "$1",
position: "relative",
variants: {
@@ -64,29 +64,21 @@ export const Tooltip = React.forwardRef(function TooltipWrapper(
disableHoverableContent={disableHoverableContent}
>
<TooltipPrimitive.Trigger asChild>{children}</TooltipPrimitive.Trigger>
-
- <Content
- ref={ref}
- side="top"
- align="center"
- sideOffset={5}
- {...props}
- multiline={multiline}
- >
- <__DEPRECATED__Text
- size="1"
- as="p"
- css={{
- color: "currentColor",
- lineHeight: multiline ? "$5" : undefined,
- }}
+ <TooltipPrimitive.Portal>
+ <Content
+ ref={ref}
+ side="top"
+ align="center"
+ sideOffset={5}
+ {...props}
+ multiline={multiline}
>
- {content}
- </__DEPRECATED__Text>
- <Box css={{ color: "$transparentExtreme" }}>
- <Arrow offset={5} width={11} height={5} />
- </Box>
- </Content>
+ <Paragraph>{content}</Paragraph>
+ <Box css={{ color: "$transparentExtreme" }}>
+ <Arrow offset={5} width={11} height={5} />
+ </Box>
+ </Content>
+ </TooltipPrimitive.Portal>
</TooltipPrimitive.Root>
);
});
diff --git a/packages/design-system/src/stitches.config.ts b/packages/design-system/src/stitches.config.ts
index cec9a822fe..e159c2e7d7 100644
--- a/packages/design-system/src/stitches.config.ts
+++ b/packages/design-system/src/stitches.config.ts
@@ -195,6 +195,7 @@ export const {
// Semantic colors
hiContrast: "$slate12",
loContrast: "$slate1",
+ hint: "$slate10",
muted: "$slate6",
primary: "$blue12",
canvas: "hsl(0 0% 93%)",
@@ -474,6 +475,7 @@ export const darkTheme = createTheme({
...goldDarkA,
// Semantic colors
+ hint: "$slate10",
muted: "$slate8",
primary: "$blue9",
hiContrast: "$slate12",