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.

Merge text and block components (#1742)

Bogdan Chadkin21f8d1aab294
diff --git a/apps/builder/app/canvas/features/text-editor/text-editor.stories.tsx b/apps/builder/app/canvas/features/text-editor/text-editor.stories.tsx
index 6f57541f66..bb168a5537 100644
--- a/apps/builder/app/canvas/features/text-editor/text-editor.stories.tsx
+++ b/apps/builder/app/canvas/features/text-editor/text-editor.stories.tsx
@@ -40,7 +40,7 @@ const createInstancePair = (
};
const instances: Instances = new Map([
- createInstancePair("1", "TextBlock", [
+ createInstancePair("1", "Text", [
{ type: "text", value: "Paragraph you can edit " },
{ type: "id", value: "2" },
{ type: "id", value: "3" },
diff --git a/apps/builder/app/shared/instance-utils.test.ts b/apps/builder/app/shared/instance-utils.test.ts
index 0b997a48c2..4dbef4b322 100644
--- a/apps/builder/app/shared/instance-utils.test.ts
+++ b/apps/builder/app/shared/instance-utils.test.ts
@@ -22,7 +22,7 @@ const createFakeComponentMetas = (
Item: { ...base, type: "container", ...itemMeta },
AnotherItem: { ...base, type: "container", ...anotherItemMeta },
Bold: { ...base, type: "rich-text-child" },
- TextBlock: { ...base, type: "container" },
+ Text: { ...base, type: "container" },
Form: { ...base, type: "container" },
Box: { ...base, type: "container" },
Div: { ...base, type: "container" },
@@ -120,7 +120,7 @@ describe("find closest droppable component index", () => {
expect(
findClosestDroppableComponentIndex(
createFakeComponentMetas({}),
- ["Bold", "Italic", "TextBlock", "Box", "Body"],
+ ["Bold", "Italic", "Text", "Box", "Body"],
["Item"]
)
).toEqual(2);
diff --git a/apps/builder/app/shared/tree-utils.test.ts b/apps/builder/app/shared/tree-utils.test.ts
index 9252d0bc6c..7b23c0bf0d 100644
--- a/apps/builder/app/shared/tree-utils.test.ts
+++ b/apps/builder/app/shared/tree-utils.test.ts
@@ -252,7 +252,7 @@ describe("insert instances into container with text or rich text children", () =
{ type: "id", value: "inserted" },
{ type: "id", value: expectString },
]),
- createInstancePair(expectString, "TextBlock", [
+ createInstancePair(expectString, "Text", [
{ type: "text", value: "text" },
]),
createInstancePair("inserted", "Box", []),
@@ -276,7 +276,7 @@ describe("insert instances into container with text or rich text children", () =
{ type: "id", value: expectString },
{ type: "id", value: "inserted" },
]),
- createInstancePair(expectString, "TextBlock", [
+ createInstancePair(expectString, "Text", [
{ type: "text", value: "text" },
]),
createInstancePair("inserted", "Box", []),
@@ -322,10 +322,8 @@ describe("insert instances into container with text or rich text children", () =
createInstancePair("italic", "Italic", [
{ type: "text", value: "italic" },
]),
- createInstancePair(expectString, "TextBlock", [
- { type: "id", value: "bold" },
- ]),
- createInstancePair(expectString, "TextBlock", [
+ createInstancePair(expectString, "Text", [{ type: "id", value: "bold" }]),
+ createInstancePair(expectString, "Text", [
{ type: "text", value: "text" },
{ type: "id", value: "italic" },
]),
@@ -355,7 +353,7 @@ describe("insert instances into container with text or rich text children", () =
createInstancePair("italic", "Italic", [
{ type: "text", value: "italic" },
]),
- createInstancePair(expectString, "TextBlock", [
+ createInstancePair(expectString, "Text", [
{ type: "id", value: "bold" },
{ type: "text", value: "text" },
{ type: "id", value: "italic" },
diff --git a/apps/builder/app/shared/tree-utils.ts b/apps/builder/app/shared/tree-utils.ts
index 9617384465..35a48e2dba 100644
--- a/apps/builder/app/shared/tree-utils.ts
+++ b/apps/builder/app/shared/tree-utils.ts
@@ -161,7 +161,7 @@ const wrapEditableChildrenAroundDropTargetMutable = (
const leftSpan: Instance = {
id: nanoid(),
type: "instance",
- component: "TextBlock",
+ component: "Text",
children: parentInstance.children.slice(0, position),
};
newChildren.push({ type: "id", value: leftSpan.id });
@@ -181,7 +181,7 @@ const wrapEditableChildrenAroundDropTargetMutable = (
const rightSpan: Instance = {
id: nanoid(),
type: "instance",
- component: "TextBlock",
+ component: "Text",
children: parentInstance.children.slice(position),
};
newChildren.push({ type: "id", value: rightSpan.id });
diff --git a/packages/icons/icons/link-block.svg b/packages/icons/icons/link-block.svg
deleted file mode 100644
index 576163fbec..0000000000
--- a/packages/icons/icons/link-block.svg
+++ /dev/null
@@ -1,3 +0,0 @@
-<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
- <path fill-rule="evenodd" clip-rule="evenodd" d="M5.17304 1.35001H10.8269C11.3641 1.35 11.8064 1.34999 12.1665 1.37941C12.5402 1.40995 12.8822 1.47538 13.2031 1.63884C13.7017 1.8929 14.1071 2.2983 14.3611 2.79693C14.5246 3.11775 14.59 3.45978 14.6206 3.83348C14.65 4.19359 14.65 4.63591 14.65 5.17307V10.8269C14.65 11.3641 14.65 11.8064 14.6206 12.1665C14.59 12.5402 14.5246 12.8823 14.3611 13.2031C14.1071 13.7017 13.7017 14.1071 13.2031 14.3612C12.8822 14.5246 12.5402 14.5901 12.1665 14.6206C11.8064 14.65 11.3641 14.65 10.8269 14.65H5.17304C4.63588 14.65 4.19356 14.65 3.83345 14.6206C3.45975 14.5901 3.11772 14.5246 2.7969 14.3612C2.29827 14.1071 1.89287 13.7017 1.63881 13.2031C1.47534 12.8823 1.40992 12.5402 1.37938 12.1665C1.34996 11.8064 1.34997 11.3641 1.34998 10.8269V5.17307C1.34997 4.63591 1.34996 4.19359 1.37938 3.83348C1.40992 3.45978 1.47534 3.11775 1.63881 2.79693C1.89287 2.2983 2.29827 1.8929 2.7969 1.63884C3.11772 1.47538 3.45975 1.40995 3.83345 1.37941C4.19356 1.34999 4.63588 1.35 5.17304 1.35001ZM3.93931 2.6751C3.646 2.69906 3.4941 2.74262 3.38709 2.79715C3.13307 2.92658 2.92655 3.1331 2.79712 3.38712C2.74259 3.49413 2.69903 3.64603 2.67507 3.93934C2.65048 4.24024 2.64998 4.62923 2.64998 5.20001V10.8C2.64998 11.3708 2.65048 11.7598 2.67507 12.0607C2.69903 12.354 2.74259 12.5059 2.79712 12.6129C2.92655 12.8669 3.13307 13.0734 3.38709 13.2029C3.4941 13.2574 3.646 13.301 3.93931 13.3249C4.24021 13.3495 4.6292 13.35 5.19998 13.35H10.8C11.3708 13.35 11.7597 13.3495 12.0606 13.3249C12.3539 13.301 12.5059 13.2574 12.6129 13.2029C12.8669 13.0734 13.0734 12.8669 13.2028 12.6129C13.2574 12.5059 13.3009 12.354 13.3249 12.0607C13.3495 11.7598 13.35 11.3708 13.35 10.8V5.20001C13.35 4.62923 13.3495 4.24024 13.3249 3.93934C13.3009 3.64603 13.2574 3.49413 13.2028 3.38712C13.0734 3.1331 12.8669 2.92658 12.6129 2.79715C12.5059 2.74262 12.3539 2.69906 12.0606 2.6751C11.7597 2.65051 11.3708 2.65001 10.8 2.65001H5.19998C4.6292 2.65001 4.24021 2.65051 3.93931 2.6751ZM10.4204 5.57966C10.0612 5.2204 9.31228 5.1822 8.73896 5.7555L8.21054 6.2839C7.9567 6.53773 7.54514 6.53773 7.29131 6.28388C7.03747 6.03004 7.03748 5.61848 7.29132 5.36464L7.81973 4.83625C8.77986 3.87615 10.3597 3.68051 11.3397 4.66041C12.3196 5.64033 12.1239 7.22018 11.1638 8.18028L10.6354 8.70867C10.3816 8.96251 9.97 8.9625 9.71616 8.70866C9.46232 8.45481 9.46233 8.04325 9.71618 7.78942L10.2446 7.26102C10.8179 6.68773 10.7797 5.93891 10.4204 5.57966ZM9.41601 6.58413C9.66985 6.83797 9.66984 7.24953 9.416 7.50337L7.50319 9.41611C7.24934 9.66995 6.83779 9.66994 6.58395 9.4161C6.33011 9.16225 6.33012 8.7507 6.58396 8.49686L8.49677 6.58412C8.75062 6.33028 9.16217 6.33029 9.41601 6.58413ZM6.28378 7.29159C6.53762 7.54544 6.53761 7.95699 6.28377 8.21083L5.75535 8.73922C5.18204 9.31252 5.22025 10.0613 5.57951 10.4206C5.93878 10.7799 6.68766 10.8181 7.26099 10.2447L7.7894 9.71635C8.04324 9.46251 8.4548 9.46252 8.70864 9.71637C8.96247 9.97021 8.96247 10.3818 8.70862 10.6356L8.18021 11.164C7.22009 12.1241 5.64022 12.3197 4.66028 11.3398C3.68033 10.3599 3.876 8.78007 4.83613 7.81997L5.36454 7.29158C5.61839 7.03774 6.02995 7.03775 6.28378 7.29159Z" fill="black"/>
-</svg>
diff --git a/packages/icons/icons/text-block.svg b/packages/icons/icons/text.svg
similarity index 100%
rename from packages/icons/icons/text-block.svg
rename to packages/icons/icons/text.svg
diff --git a/packages/icons/src/__generated__/index.ts b/packages/icons/src/__generated__/index.ts
index 0ca5240d5b..1f2d1b9448 100644
--- a/packages/icons/src/__generated__/index.ts
+++ b/packages/icons/src/__generated__/index.ts
@@ -86,7 +86,6 @@ export * from "./j-c-space-between";
export * from "./j-c-start";
export * from "./link-2-unlinked";
export * from "./link-2";
-export * from "./link-block";
export * from "./link";
export * from "./list-item";
export * from "./list";
@@ -117,8 +116,8 @@ export * from "./subscript";
export * from "./subtract";
export * from "./superscript";
export * from "./text-align-left";
-export * from "./text-block";
export * from "./text-italic";
+export * from "./text";
export * from "./video";
export * from "./vimeo";
export * from "./webstudio";
diff --git a/packages/icons/src/__generated__/link-block.tsx b/packages/icons/src/__generated__/link-block.tsx
deleted file mode 100644
index 2260c3b16f..0000000000
--- a/packages/icons/src/__generated__/link-block.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-// Generated from icons/link-block.svg
-
-import { forwardRef } from "react";
-import type { IconProps } from "../types";
-
-// prettier-ignore
-export const LinkBlockIcon = forwardRef<SVGSVGElement, IconProps>(
- ({ color = "currentColor", size = 16, ...props }, forwardedRef) => {
- return (
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width={size} height={size} fill={color} {...props} ref={forwardedRef}><path fillRule="evenodd" d="M5.173 1.35h5.654c.537 0 .98 0 1.34.03.373.03.715.095 1.036.259.499.254.904.66 1.158 1.158.164.32.229.663.26 1.036.029.36.029.803.029 1.34v5.654c0 .537 0 .98-.03 1.34-.03.373-.095.715-.259 1.036a2.65 2.65 0 0 1-1.158 1.158c-.32.164-.663.23-1.037.26-.36.029-.802.029-1.34.029H5.174c-.537 0-.98 0-1.34-.03-.373-.03-.715-.095-1.036-.259a2.65 2.65 0 0 1-1.158-1.158c-.164-.32-.23-.663-.26-1.037-.029-.36-.029-.802-.029-1.34V5.174c0-.537 0-.98.03-1.34.03-.373.095-.715.259-1.036a2.65 2.65 0 0 1 1.158-1.158c.32-.164.663-.229 1.036-.26.36-.029.803-.029 1.34-.029ZM3.939 2.675c-.293.024-.445.068-.552.122a1.35 1.35 0 0 0-.59.59c-.054.107-.098.259-.122.552-.025.301-.025.69-.025 1.261v5.6c0 .57 0 .96.025 1.26.024.294.068.446.122.553.13.254.336.46.59.59.107.054.259.098.552.122.301.025.69.025 1.261.025h5.6c.57 0 .96 0 1.26-.025.294-.024.446-.068.553-.122.254-.13.46-.336.59-.59.054-.107.098-.259.122-.552.025-.301.025-.69.025-1.261V5.2c0-.57 0-.96-.025-1.26-.024-.294-.068-.446-.122-.553a1.35 1.35 0 0 0-.59-.59c-.107-.054-.26-.098-.552-.122-.301-.024-.69-.025-1.261-.025H5.2c-.57 0-.96 0-1.26.025ZM10.42 5.58c-.359-.36-1.108-.398-1.681.175l-.528.529a.65.65 0 1 1-.92-.92l.529-.528c.96-.96 2.54-1.155 3.52-.176.98.98.784 2.56-.176 3.52l-.529.529a.65.65 0 1 1-.919-.92l.529-.528c.573-.573.535-1.322.175-1.681ZM9.416 6.584a.65.65 0 0 1 0 .92L7.503 9.415a.65.65 0 0 1-.919-.92l1.913-1.912a.65.65 0 0 1 .919 0Zm-3.132.708a.65.65 0 0 1 0 .919l-.529.528c-.573.574-.535 1.322-.175 1.682.359.359 1.108.397 1.681-.176l.528-.529a.65.65 0 1 1 .92.92l-.529.528c-.96.96-2.54 1.156-3.52.176s-.784-2.56.176-3.52l.529-.528a.65.65 0 0 1 .919 0Z" clipRule="evenodd" /></svg>
- );
- }
-);
-
-LinkBlockIcon.displayName = "LinkBlockIcon";
diff --git a/packages/icons/src/__generated__/svg/index.ts b/packages/icons/src/__generated__/svg/index.ts
index b0bdc34dd2..df0d355e82 100644
--- a/packages/icons/src/__generated__/svg/index.ts
+++ b/packages/icons/src/__generated__/svg/index.ts
@@ -86,7 +86,6 @@ export { JCSpaceBetweenIcon } from "./j-c-space-between";
export { JCStartIcon } from "./j-c-start";
export { Link2UnlinkedIcon } from "./link-2-unlinked";
export { Link2Icon } from "./link-2";
-export { LinkBlockIcon } from "./link-block";
export { LinkIcon } from "./link";
export { ListItemIcon } from "./list-item";
export { ListIcon } from "./list";
@@ -117,8 +116,8 @@ export { SubscriptIcon } from "./subscript";
export { SubtractIcon } from "./subtract";
export { SuperscriptIcon } from "./superscript";
export { TextAlignLeftIcon } from "./text-align-left";
-export { TextBlockIcon } from "./text-block";
export { TextItalicIcon } from "./text-italic";
+export { TextIcon } from "./text";
export { VideoIcon } from "./video";
export { VimeoIcon } from "./vimeo";
export { WebstudioIcon } from "./webstudio";
diff --git a/packages/icons/src/__generated__/svg/link-block.ts b/packages/icons/src/__generated__/svg/link-block.ts
deleted file mode 100644
index 2b64fcf348..0000000000
--- a/packages/icons/src/__generated__/svg/link-block.ts
+++ /dev/null
@@ -1 +0,0 @@
-export const LinkBlockIcon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" width="100%" height="100%" style="display: block;"><path fill-rule="evenodd" d="M5.173 1.35h5.654c.537 0 .98 0 1.34.03.373.03.715.095 1.036.259.499.254.904.66 1.158 1.158.164.32.229.663.26 1.036.029.36.029.803.029 1.34v5.654c0 .537 0 .98-.03 1.34-.03.373-.095.715-.259 1.036a2.65 2.65 0 0 1-1.158 1.158c-.32.164-.663.23-1.037.26-.36.029-.802.029-1.34.029H5.174c-.537 0-.98 0-1.34-.03-.373-.03-.715-.095-1.036-.259a2.65 2.65 0 0 1-1.158-1.158c-.164-.32-.23-.663-.26-1.037-.029-.36-.029-.802-.029-1.34V5.174c0-.537 0-.98.03-1.34.03-.373.095-.715.259-1.036a2.65 2.65 0 0 1 1.158-1.158c.32-.164.663-.229 1.036-.26.36-.029.803-.029 1.34-.029ZM3.939 2.675c-.293.024-.445.068-.552.122a1.35 1.35 0 0 0-.59.59c-.054.107-.098.259-.122.552-.025.301-.025.69-.025 1.261v5.6c0 .57 0 .96.025 1.26.024.294.068.446.122.553.13.254.336.46.59.59.107.054.259.098.552.122.301.025.69.025 1.261.025h5.6c.57 0 .96 0 1.26-.025.294-.024.446-.068.553-.122.254-.13.46-.336.59-.59.054-.107.098-.259.122-.552.025-.301.025-.69.025-1.261V5.2c0-.57 0-.96-.025-1.26-.024-.294-.068-.446-.122-.553a1.35 1.35 0 0 0-.59-.59c-.107-.054-.26-.098-.552-.122-.301-.024-.69-.025-1.261-.025H5.2c-.57 0-.96 0-1.26.025ZM10.42 5.58c-.359-.36-1.108-.398-1.681.175l-.528.529a.65.65 0 1 1-.92-.92l.529-.528c.96-.96 2.54-1.155 3.52-.176.98.98.784 2.56-.176 3.52l-.529.529a.65.65 0 1 1-.919-.92l.529-.528c.573-.573.535-1.322.175-1.681ZM9.416 6.584a.65.65 0 0 1 0 .92L7.503 9.415a.65.65 0 0 1-.919-.92l1.913-1.912a.65.65 0 0 1 .919 0Zm-3.132.708a.65.65 0 0 1 0 .919l-.529.528c-.573.574-.535 1.322-.175 1.682.359.359 1.108.397 1.681-.176l.528-.529a.65.65 0 1 1 .92.92l-.529.528c-.96.96-2.54 1.156-3.52.176s-.784-2.56.176-3.52l.529-.528a.65.65 0 0 1 .919 0Z" clip-rule="evenodd"/></svg>`;
diff --git a/packages/icons/src/__generated__/svg/text-block.ts b/packages/icons/src/__generated__/svg/text-block.ts
deleted file mode 100644
index a83969c5f7..0000000000
--- a/packages/icons/src/__generated__/svg/text-block.ts
+++ /dev/null
@@ -1 +0,0 @@
-export const TextBlockIcon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" width="100%" height="100%" style="display: block;"><path fill-rule="evenodd" d="M5.173 1.35h5.654c.537 0 .98 0 1.34.03.373.03.715.095 1.036.259.499.254.904.66 1.158 1.158.164.32.229.663.26 1.037.029.36.029.802.029 1.34v5.653c0 .537 0 .98-.03 1.34-.03.373-.095.715-.259 1.036a2.65 2.65 0 0 1-1.158 1.158c-.32.164-.663.23-1.037.26-.36.03-.802.03-1.34.03H5.174c-.537 0-.98 0-1.34-.03-.373-.03-.715-.096-1.036-.26a2.65 2.65 0 0 1-1.158-1.158c-.164-.32-.23-.663-.26-1.036-.029-.36-.029-.803-.029-1.34V5.173c0-.537 0-.98.03-1.34.03-.373.095-.715.259-1.036a2.65 2.65 0 0 1 1.158-1.158c.32-.164.663-.229 1.036-.26.36-.029.803-.029 1.34-.029ZM3.939 2.675c-.293.024-.445.068-.552.122a1.35 1.35 0 0 0-.59.59c-.054.107-.098.26-.122.552-.025.301-.025.69-.025 1.261v5.6c0 .57 0 .96.025 1.26.024.294.068.446.122.553.13.254.336.46.59.59.107.055.259.098.552.122.301.025.69.025 1.261.025h5.6c.57 0 .96 0 1.26-.025.294-.024.446-.067.553-.122.254-.13.46-.336.59-.59.054-.107.098-.259.122-.552.025-.301.025-.69.025-1.26V5.2c0-.572 0-.96-.025-1.262-.024-.293-.068-.445-.122-.552a1.35 1.35 0 0 0-.59-.59c-.107-.054-.26-.098-.552-.122-.301-.024-.69-.025-1.261-.025H5.2c-.57 0-.96 0-1.26.025ZM5.2 4.017H10.8c.082 0 .177 0 .261.007a.995.995 0 0 1 .377.1.99.99 0 0 1 .433.433c.073.144.093.28.101.378.007.083.007.179.007.26v.806a.65.65 0 1 1-1.3 0v-.684H8.65v5.366H10a.65.65 0 1 1 0 1.3H6a.65.65 0 1 1 0-1.3h1.35V5.317H5.32V6a.65.65 0 0 1-1.3 0v-.805c0-.081 0-.177.007-.26a.995.995 0 0 1 .1-.378.99.99 0 0 1 .434-.432.995.995 0 0 1 .377-.101c.084-.007.18-.007.26-.007Z" clip-rule="evenodd"/></svg>`;
diff --git a/packages/icons/src/__generated__/svg/text.ts b/packages/icons/src/__generated__/svg/text.ts
new file mode 100644
index 0000000000..9b190f3c13
--- /dev/null
+++ b/packages/icons/src/__generated__/svg/text.ts
@@ -0,0 +1 @@
+export const TextIcon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" width="100%" height="100%" style="display: block;"><path fill-rule="evenodd" d="M5.173 1.35h5.654c.537 0 .98 0 1.34.03.373.03.715.095 1.036.259.499.254.904.66 1.158 1.158.164.32.229.663.26 1.037.029.36.029.802.029 1.34v5.653c0 .537 0 .98-.03 1.34-.03.373-.095.715-.259 1.036a2.65 2.65 0 0 1-1.158 1.158c-.32.164-.663.23-1.037.26-.36.03-.802.03-1.34.03H5.174c-.537 0-.98 0-1.34-.03-.373-.03-.715-.096-1.036-.26a2.65 2.65 0 0 1-1.158-1.158c-.164-.32-.23-.663-.26-1.036-.029-.36-.029-.803-.029-1.34V5.173c0-.537 0-.98.03-1.34.03-.373.095-.715.259-1.036a2.65 2.65 0 0 1 1.158-1.158c.32-.164.663-.229 1.036-.26.36-.029.803-.029 1.34-.029ZM3.939 2.675c-.293.024-.445.068-.552.122a1.35 1.35 0 0 0-.59.59c-.054.107-.098.26-.122.552-.025.301-.025.69-.025 1.261v5.6c0 .57 0 .96.025 1.26.024.294.068.446.122.553.13.254.336.46.59.59.107.055.259.098.552.122.301.025.69.025 1.261.025h5.6c.57 0 .96 0 1.26-.025.294-.024.446-.067.553-.122.254-.13.46-.336.59-.59.054-.107.098-.259.122-.552.025-.301.025-.69.025-1.26V5.2c0-.572 0-.96-.025-1.262-.024-.293-.068-.445-.122-.552a1.35 1.35 0 0 0-.59-.59c-.107-.054-.26-.098-.552-.122-.301-.024-.69-.025-1.261-.025H5.2c-.57 0-.96 0-1.26.025ZM5.2 4.017H10.8c.082 0 .177 0 .261.007a.995.995 0 0 1 .377.1.99.99 0 0 1 .433.433c.073.144.093.28.101.378.007.083.007.179.007.26v.806a.65.65 0 1 1-1.3 0v-.684H8.65v5.366H10a.65.65 0 1 1 0 1.3H6a.65.65 0 1 1 0-1.3h1.35V5.317H5.32V6a.65.65 0 0 1-1.3 0v-.805c0-.081 0-.177.007-.26a.995.995 0 0 1 .1-.378.99.99 0 0 1 .434-.432.995.995 0 0 1 .377-.101c.084-.007.18-.007.26-.007Z" clip-rule="evenodd"/></svg>`;
diff --git a/packages/icons/src/__generated__/text-block.tsx b/packages/icons/src/__generated__/text.tsx
similarity index 92%
rename from packages/icons/src/__generated__/text-block.tsx
rename to packages/icons/src/__generated__/text.tsx
index ed6205af2c..d49608a131 100644
--- a/packages/icons/src/__generated__/text-block.tsx
+++ b/packages/icons/src/__generated__/text.tsx
@@ -1,10 +1,10 @@
-// Generated from icons/text-block.svg
+// Generated from icons/text.svg
import { forwardRef } from "react";
import type { IconProps } from "../types";
// prettier-ignore
-export const TextBlockIcon = forwardRef<SVGSVGElement, IconProps>(
+export const TextIcon = forwardRef<SVGSVGElement, IconProps>(
({ color = "currentColor", size = 16, ...props }, forwardedRef) => {
return (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width={size} height={size} fill={color} {...props} ref={forwardedRef}><path fillRule="evenodd" d="M5.173 1.35h5.654c.537 0 .98 0 1.34.03.373.03.715.095 1.036.259.499.254.904.66 1.158 1.158.164.32.229.663.26 1.037.029.36.029.802.029 1.34v5.653c0 .537 0 .98-.03 1.34-.03.373-.095.715-.259 1.036a2.65 2.65 0 0 1-1.158 1.158c-.32.164-.663.23-1.037.26-.36.03-.802.03-1.34.03H5.174c-.537 0-.98 0-1.34-.03-.373-.03-.715-.096-1.036-.26a2.65 2.65 0 0 1-1.158-1.158c-.164-.32-.23-.663-.26-1.036-.029-.36-.029-.803-.029-1.34V5.173c0-.537 0-.98.03-1.34.03-.373.095-.715.259-1.036a2.65 2.65 0 0 1 1.158-1.158c.32-.164.663-.229 1.036-.26.36-.029.803-.029 1.34-.029ZM3.939 2.675c-.293.024-.445.068-.552.122a1.35 1.35 0 0 0-.59.59c-.054.107-.098.26-.122.552-.025.301-.025.69-.025 1.261v5.6c0 .57 0 .96.025 1.26.024.294.068.446.122.553.13.254.336.46.59.59.107.055.259.098.552.122.301.025.69.025 1.261.025h5.6c.57 0 .96 0 1.26-.025.294-.024.446-.067.553-.122.254-.13.46-.336.59-.59.054-.107.098-.259.122-.552.025-.301.025-.69.025-1.26V5.2c0-.572 0-.96-.025-1.262-.024-.293-.068-.445-.122-.552a1.35 1.35 0 0 0-.59-.59c-.107-.054-.26-.098-.552-.122-.301-.024-.69-.025-1.261-.025H5.2c-.57 0-.96 0-1.26.025ZM5.2 4.017H10.8c.082 0 .177 0 .261.007a.995.995 0 0 1 .377.1.99.99 0 0 1 .433.433c.073.144.093.28.101.378.007.083.007.179.007.26v.806a.65.65 0 1 1-1.3 0v-.684H8.65v5.366H10a.65.65 0 1 1 0 1.3H6a.65.65 0 1 1 0-1.3h1.35V5.317H5.32V6a.65.65 0 0 1-1.3 0v-.805c0-.081 0-.177.007-.26a.995.995 0 0 1 .1-.378.99.99 0 0 1 .434-.432.995.995 0 0 1 .377-.101c.084-.007.18-.007.26-.007Z" clipRule="evenodd" /></svg>
@@ -12,4 +12,4 @@ export const TextBlockIcon = forwardRef<SVGSVGElement, IconProps>(
}
);
-TextBlockIcon.displayName = "TextBlockIcon";
+TextIcon.displayName = "TextIcon";
diff --git a/packages/prisma-client/prisma/migrations/20230611121710_merge_block_text_components/migration.ts b/packages/prisma-client/prisma/migrations/20230611121710_merge_block_text_components/migration.ts
new file mode 100644
index 0000000000..f1a596efdc
--- /dev/null
+++ b/packages/prisma-client/prisma/migrations/20230611121710_merge_block_text_components/migration.ts
@@ -0,0 +1,78 @@
+import { PrismaClient } from "./client";
+
+type Text = {
+ type: "text";
+ value: string;
+};
+
+type Id = {
+ type: "id";
+ value: string;
+};
+
+export type Instance = {
+ type: "instance";
+ id: string;
+ component: string;
+ label?: string;
+ children: Array<Id | Text>;
+};
+
+type InstancesList = Instance[];
+
+export default async () => {
+ const client = new PrismaClient({
+ // Uncomment to see the queries in console as the migration runs
+ // log: ["query", "info", "warn", "error"],
+ });
+
+ await client.$transaction(
+ async (prisma) => {
+ const chunkSize = 1000;
+ let cursor: undefined | string = undefined;
+ let hasNext = true;
+ while (hasNext) {
+ const builds = await prisma.build.findMany({
+ take: chunkSize,
+ orderBy: {
+ id: "asc",
+ },
+ ...(cursor
+ ? {
+ skip: 1, // Skip the cursor
+ cursor: { id: cursor },
+ }
+ : null),
+ });
+ cursor = builds.at(-1)?.id;
+ hasNext = builds.length === chunkSize;
+
+ for (const build of builds) {
+ const buildId = build.id;
+ try {
+ const instancesList: InstancesList = JSON.parse(build.instances);
+
+ for (const instance of instancesList) {
+ if (instance.component === "TextBlock") {
+ instance.component = "Text";
+ }
+ if (instance.component === "LinkBlock") {
+ instance.component = "Link";
+ }
+ }
+
+ build.instances = JSON.stringify(instancesList);
+ } catch {
+ console.info(`build ${buildId} cannot be converted`);
+ }
+ }
+ await Promise.all(
+ builds.map(({ id, instances, props }) =>
+ prisma.build.update({ where: { id }, data: { instances, props } })
+ )
+ );
+ }
+ },
+ { timeout: 1000 * 60 * 8 }
+ );
+};
diff --git a/packages/prisma-client/prisma/migrations/20230611121710_merge_block_text_components/schema.prisma b/packages/prisma-client/prisma/migrations/20230611121710_merge_block_text_components/schema.prisma
new file mode 100644
index 0000000000..9ead9c752b
--- /dev/null
+++ b/packages/prisma-client/prisma/migrations/20230611121710_merge_block_text_components/schema.prisma
@@ -0,0 +1,232 @@
+// DO NOT EDIT THIS FILE!
+// This is a copy of your schema.prisma that corresponds to the state of the database
+// when all migrations up until this one are applied.
+// It's used to generate a Prisma Client for the migration.
+
+// This is your Prisma schema file,
+// learn more about it in the docs: https://pris.ly/d/prisma-schema
+
+generator client {
+ provider = "prisma-client-js"
+ previewFeatures = ["views", "clientExtensions", "jsonProtocol"]
+ // see commands.ts
+ output = "client"
+}
+
+datasource db {
+ provider = "postgres"
+ url = env("DATABASE_URL")
+}
+
+model Team {
+ id String @id @default(uuid())
+ users User[]
+}
+
+enum UploadStatus {
+ UPLOADING
+ UPLOADED
+}
+
+model File {
+ name String @id
+ format String
+ size Int
+ description String?
+ createdAt DateTime @default(now())
+ updatedAt DateTime @default(now()) @updatedAt
+ meta String @default("{}")
+ status UploadStatus @default(UPLOADING)
+ isDeleted Boolean @default(false)
+ uploaderProject Project? @relation(fields: [uploaderProjectId], references: [id])
+ uploaderProjectId String?
+ assets Asset[]
+}
+
+model Asset {
+ id String @default(uuid()) // not unique!
+ projectId String
+ file File @relation(fields: [name], references: [name])
+ name String
+
+ @@id([id, projectId])
+}
+
+model User {
+ id String @id @default(uuid())
+ email String? @unique
+ provider String?
+ image String?
+ username String?
+ createdAt DateTime @default(now())
+ team Team? @relation(fields: [teamId], references: [id])
+ teamId String?
+ projects Project[]
+}
+
+model Project {
+ id String @id @default(uuid())
+ createdAt DateTime @default(now())
+ title String
+ domain String @unique
+ user User? @relation(fields: [userId], references: [id])
+ userId String?
+ build Build[]
+ isDeleted Boolean @default(false)
+ files File[]
+ projectDomain ProjectDomain[]
+ latestBuild LatestBuildPerProject?
+
+ @@unique([id, isDeleted])
+ @@unique([domain, isDeleted])
+ @@unique([id, domain])
+}
+
+enum PublishStatus {
+ PENDING
+ PUBLISHED
+ FAILED
+}
+
+model Build {
+ id String @unique @default(uuid())
+ version Int @default(0)
+ createdAt DateTime @default(now())
+ updatedAt DateTime @default(now()) @updatedAt
+ pages String
+
+ project Project @relation(fields: [projectId], references: [id])
+ projectId String
+
+ breakpoints String @default("[]")
+ styles String @default("[]")
+ styleSources String @default("[]")
+ styleSourceSelections String @default("[]")
+ props String @default("[]")
+ instances String @default("[]")
+
+ deployment String?
+ publishStatus PublishStatus @default(PENDING)
+
+ @@id([id, projectId])
+}
+
+enum AuthorizationRelation {
+ viewers
+ editors
+ builders
+}
+
+model AuthorizationToken {
+ token String @default(uuid())
+ // No relation to Project, as the Authorization system is not tied to a project
+ projectId String
+ name String @default("")
+ relation AuthorizationRelation @default(viewers)
+ createdAt DateTime @default(now())
+
+ @@id([token, projectId])
+}
+
+enum DomainStatus {
+ INITIALIZING
+ ACTIVE
+ ERROR
+ PENDING
+}
+
+// Domains + last known status and last known txtRecord
+// In the future we can update this table using queue, n8n or temporal workflows.
+// As of now updates are done during UI interactions
+model Domain {
+ id String @id @default(uuid())
+ domain String @unique
+ createdAt DateTime @default(now())
+ updatedAt DateTime @default(now()) @updatedAt
+
+ ProjectDomain ProjectDomain[]
+ // Last known txtRecord of the domain (to check domain ownership)
+ txtRecord String?
+ // create, init, pending, active, error
+ status DomainStatus @default(INITIALIZING)
+ // In case of status="error", this will contain the error message
+ error String?
+
+ projectWithDomain ProjectWithDomain[]
+}
+
+model ProjectDomain {
+ projectId String
+ project Project @relation(fields: [projectId], references: [id])
+ domainId String
+ domain Domain @relation(fields: [domainId], references: [id])
+ createdAt DateTime @default(now())
+ // Generated txt record to check domain ownership
+ txtRecord String @unique @default(uuid())
+
+ // CNAME record to point to the domain
+ cname String
+
+ @@id([projectId, domainId])
+ @@index([domainId])
+}
+
+view ProjectWithDomain {
+ projectId String
+
+ domainId String
+ domain Domain @relation(fields: [domainId], references: [id])
+ txtRecord String
+
+ createdAt DateTime
+
+ // CNAME record to point to the domain
+ cname String
+
+ verified Boolean
+ // To count statistics per user
+ userId String?
+
+ // We can deploy on per domain basis, here for each project domain we have latest build
+ latestBuid LatestBuildPerProjectDomain?
+
+ @@id([projectId, domainId])
+}
+
+view LatestBuildPerProjectDomain {
+ domainId String
+ buildId String
+ projectId String
+ projectWithDomain ProjectWithDomain @relation(fields: [projectId, domainId], references: [projectId, domainId])
+
+ isLatestBuild Boolean
+ publishStatus PublishStatus
+ updatedAt DateTime
+
+ @@id([projectId, domainId])
+}
+
+view LatestBuildPerProject {
+ buildId String
+
+ projectId String
+ domain String
+ project Project @relation(fields: [projectId, domain], references: [id, domain])
+
+ isLatestBuild Boolean
+ publishStatus PublishStatus
+ updatedAt DateTime
+
+ @@id([projectId, domain])
+}
+
+// Dashboard
+view DashboardProject {
+ id String @id @default(uuid())
+ createdAt DateTime @default(now())
+ title String
+ domain String
+ userId String?
+ isDeleted Boolean @default(false)
+ isPublished Boolean
+}
diff --git a/packages/sdk-components-react-remix/src/components.ts b/packages/sdk-components-react-remix/src/components.ts
index 7645047777..9572d51030 100644
--- a/packages/sdk-components-react-remix/src/components.ts
+++ b/packages/sdk-components-react-remix/src/components.ts
@@ -1,4 +1,3 @@
export { Link } from "./link";
-export { LinkBlock } from "./link-block";
export { RichTextLink } from "./rich-text-link";
export { Form } from "./form";
diff --git a/packages/sdk-components-react-remix/src/form.ws.tsx b/packages/sdk-components-react-remix/src/form.ws.tsx
index cf189ea1cb..e0edfe42ad 100644
--- a/packages/sdk-components-react-remix/src/form.ws.tsx
+++ b/packages/sdk-components-react-remix/src/form.ws.tsx
@@ -64,7 +64,7 @@ export const meta: WsComponentMeta = {
children: [
{
type: "instance",
- component: "TextBlock",
+ component: "Text",
children: [
{ type: "text", value: "Thank you for getting in touch!" },
],
@@ -77,7 +77,7 @@ export const meta: WsComponentMeta = {
children: [
{
type: "instance",
- component: "TextBlock",
+ component: "Text",
children: [
{ type: "text", value: "Sorry, something went wrong." },
],
diff --git a/packages/sdk-components-react-remix/src/link-block.tsx b/packages/sdk-components-react-remix/src/link-block.tsx
deleted file mode 100644
index c0b3337f2c..0000000000
--- a/packages/sdk-components-react-remix/src/link-block.tsx
+++ /dev/null
@@ -1,4 +0,0 @@
-import { LinkBlock as BaseLink } from "@webstudio-is/sdk-components-react";
-import { wrapLinkComponent } from "./shared/remix-link";
-
-export const LinkBlock = wrapLinkComponent(BaseLink);
diff --git a/packages/sdk-components-react-remix/src/link-block.ws.tsx b/packages/sdk-components-react-remix/src/link-block.ws.tsx
deleted file mode 100644
index 412da4091e..0000000000
--- a/packages/sdk-components-react-remix/src/link-block.ws.tsx
+++ /dev/null
@@ -1,6 +0,0 @@
-import type { WsComponentPropsMeta } from "@webstudio-is/react-sdk";
-import { propsMeta as linkPropsMeta } from "./link.ws";
-
-export { LinkBlock as meta } from "@webstudio-is/sdk-components-react/metas";
-
-export const propsMeta: WsComponentPropsMeta = linkPropsMeta;
diff --git a/packages/sdk-components-react-remix/src/props.ts b/packages/sdk-components-react-remix/src/props.ts
index a27f60c149..2278fcbbf7 100644
--- a/packages/sdk-components-react-remix/src/props.ts
+++ b/packages/sdk-components-react-remix/src/props.ts
@@ -1,4 +1,3 @@
export { propsMeta as Form } from "./form.ws";
export { propsMeta as Link } from "./link.ws";
-export { propsMeta as LinkBlock } from "./link-block.ws";
export { propsMeta as RichTextLink } from "./rich-text-link.ws";
diff --git a/packages/sdk-components-react/src/__generated__/text-block.props.ts b/packages/sdk-components-react/src/__generated__/text.props.ts
similarity index 100%
rename from packages/sdk-components-react/src/__generated__/text-block.props.ts
rename to packages/sdk-components-react/src/__generated__/text.props.ts
diff --git a/packages/sdk-components-react/src/checkbox-field.ws.tsx b/packages/sdk-components-react/src/checkbox-field.ws.tsx
index 51b3c64e46..96b8b6bba1 100644
--- a/packages/sdk-components-react/src/checkbox-field.ws.tsx
+++ b/packages/sdk-components-react/src/checkbox-field.ws.tsx
@@ -31,7 +31,7 @@ export const meta: WsComponentMeta = {
{ type: "instance", component: "Checkbox", children: [] },
{
type: "instance",
- component: "TextBlock",
+ component: "Text",
label: "Checkbox Label",
props: [],
children: [{ type: "text", value: "Checkbox" }],
diff --git a/packages/sdk-components-react/src/components.ts b/packages/sdk-components-react/src/components.ts
index 968d92a3f0..801c8b6dd3 100644
--- a/packages/sdk-components-react/src/components.ts
+++ b/packages/sdk-components-react/src/components.ts
@@ -3,11 +3,10 @@ export { Fragment } from "./fragment";
export { HtmlEmbed } from "./html-embed";
export { Body } from "./body";
export { Box } from "./box";
-export { TextBlock } from "./text-block";
+export { Text } from "./text";
export { Heading } from "./heading";
export { Paragraph } from "./paragraph";
export { Link } from "./link";
-export { LinkBlock } from "./link-block";
export { RichTextLink } from "./rich-text-link";
export { Span } from "./span";
export { Bold } from "./bold";
diff --git a/packages/sdk-components-react/src/label.ws.tsx b/packages/sdk-components-react/src/label.ws.tsx
index 32de54ac8c..9ee112d2c8 100644
--- a/packages/sdk-components-react/src/label.ws.tsx
+++ b/packages/sdk-components-react/src/label.ws.tsx
@@ -1,4 +1,4 @@
-import { TextBlockIcon } from "@webstudio-is/icons/svg";
+import { TextIcon } from "@webstudio-is/icons/svg";
import {
type WsComponentMeta,
type WsComponentPropsMeta,
@@ -20,7 +20,7 @@ export const meta: WsComponentMeta = {
category: "forms",
type: "container",
label: "Input Label",
- icon: TextBlockIcon,
+ icon: TextIcon,
states: defaultStates,
presetStyle,
order: 2,
diff --git a/packages/sdk-components-react/src/link-block.stories.tsx b/packages/sdk-components-react/src/link-block.stories.tsx
deleted file mode 100644
index d6747a7e56..0000000000
--- a/packages/sdk-components-react/src/link-block.stories.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-import type { ComponentStory, ComponentMeta } from "@storybook/react";
-import { LinkBlock as LinkBlockPrimitive } from "./link-block";
-
-export default {
- title: "Components/Link Block",
- component: LinkBlockPrimitive,
-} as ComponentMeta<typeof LinkBlockPrimitive>;
-
-const Template: ComponentStory<typeof LinkBlockPrimitive> = (args) => (
- <LinkBlockPrimitive {...args} />
-);
-
-export const LinkBlock = Template.bind({});
-LinkBlock.args = {
- children: "Link Block",
-};
diff --git a/packages/sdk-components-react/src/link-block.tsx b/packages/sdk-components-react/src/link-block.tsx
deleted file mode 100644
index 3dede5007f..0000000000
--- a/packages/sdk-components-react/src/link-block.tsx
+++ /dev/null
@@ -1,9 +0,0 @@
-import { forwardRef } from "react";
-import { Link } from "./link";
-export { defaultTag } from "./link";
-
-export const LinkBlock: typeof Link = forwardRef((props, ref) => (
- <Link {...props} ref={ref} />
-));
-
-LinkBlock.displayName = "LinkBlock";
diff --git a/packages/sdk-components-react/src/link-block.ws.tsx b/packages/sdk-components-react/src/link-block.ws.tsx
deleted file mode 100644
index e6e0b41574..0000000000
--- a/packages/sdk-components-react/src/link-block.ws.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-import { LinkBlockIcon } from "@webstudio-is/icons/svg";
-import type {
- PresetStyle,
- WsComponentMeta,
- WsComponentPropsMeta,
-} from "@webstudio-is/react-sdk";
-import { a } from "@webstudio-is/react-sdk/css-normalize";
-import { meta as linkMeta, propsMeta as linkPropsMeta } from "./link.ws";
-import type { defaultTag } from "./link-block";
-
-const presetStyle = {
- a: [
- ...a,
- {
- property: "display",
- value: { type: "keyword", value: "inline-block" },
- },
- ],
-} satisfies PresetStyle<typeof defaultTag>;
-
-export const meta: WsComponentMeta = {
- category: "general",
- type: "container",
- label: "Link Block",
- icon: LinkBlockIcon,
- states: linkMeta.states,
- presetStyle,
- order: 2,
-};
-
-export const propsMeta: WsComponentPropsMeta = linkPropsMeta;
diff --git a/packages/sdk-components-react/src/metas.ts b/packages/sdk-components-react/src/metas.ts
index f749d9d531..193bb1781b 100644
--- a/packages/sdk-components-react/src/metas.ts
+++ b/packages/sdk-components-react/src/metas.ts
@@ -3,11 +3,10 @@ export { meta as Fragment } from "./fragment.ws";
export { meta as HtmlEmbed } from "./html-embed.ws";
export { meta as Body } from "./body.ws";
export { meta as Box } from "./box.ws";
-export { meta as TextBlock } from "./text-block.ws";
+export { meta as Text } from "./text.ws";
export { meta as Heading } from "./heading.ws";
export { meta as Paragraph } from "./paragraph.ws";
export { meta as Link } from "./link.ws";
-export { meta as LinkBlock } from "./link-block.ws";
export { meta as RichTextLink } from "./rich-text-link.ws";
export { meta as Span } from "./span.ws";
export { meta as Bold } from "./bold.ws";
diff --git a/packages/sdk-components-react/src/props.ts b/packages/sdk-components-react/src/props.ts
index 88e8b849bd..a523b02598 100644
--- a/packages/sdk-components-react/src/props.ts
+++ b/packages/sdk-components-react/src/props.ts
@@ -3,11 +3,10 @@ export { propsMeta as Fragment } from "./fragment.ws";
export { propsMeta as HtmlEmbed } from "./html-embed.ws";
export { propsMeta as Body } from "./body.ws";
export { propsMeta as Box } from "./box.ws";
-export { propsMeta as TextBlock } from "./text-block.ws";
+export { propsMeta as Text } from "./text.ws";
export { propsMeta as Heading } from "./heading.ws";
export { propsMeta as Paragraph } from "./paragraph.ws";
export { propsMeta as Link } from "./link.ws";
-export { propsMeta as LinkBlock } from "./link-block.ws";
export { propsMeta as RichTextLink } from "./rich-text-link.ws";
export { propsMeta as Span } from "./span.ws";
export { propsMeta as Bold } from "./bold.ws";
diff --git a/packages/sdk-components-react/src/radio-button-field.ws.tsx b/packages/sdk-components-react/src/radio-button-field.ws.tsx
index 1714248d81..0bac79f697 100644
--- a/packages/sdk-components-react/src/radio-button-field.ws.tsx
+++ b/packages/sdk-components-react/src/radio-button-field.ws.tsx
@@ -31,7 +31,7 @@ export const meta: WsComponentMeta = {
{ type: "instance", component: "RadioButton", props: [], children: [] },
{
type: "instance",
- component: "TextBlock",
+ component: "Text",
label: "Radio Label",
props: [],
children: [{ type: "text", value: "Radio" }],
diff --git a/packages/sdk-components-react/src/span.ws.tsx b/packages/sdk-components-react/src/span.ws.tsx
index 06336b3a24..4c97ae2237 100644
--- a/packages/sdk-components-react/src/span.ws.tsx
+++ b/packages/sdk-components-react/src/span.ws.tsx
@@ -15,7 +15,7 @@ const presetStyle = {
export const meta: WsComponentMeta = {
type: "rich-text-child",
- label: "Styled Text",
+ label: "Text",
icon: PaintBrushIcon,
states: defaultStates,
presetStyle,
diff --git a/packages/sdk-components-react/src/text-block.stories.tsx b/packages/sdk-components-react/src/text-block.stories.tsx
deleted file mode 100644
index b642448e97..0000000000
--- a/packages/sdk-components-react/src/text-block.stories.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-import type { ComponentStory, ComponentMeta } from "@storybook/react";
-import { TextBlock as TextBlockPrimitive } from "./text-block";
-
-export default {
- title: "Components/TextBlock",
- component: TextBlockPrimitive,
-} as ComponentMeta<typeof TextBlockPrimitive>;
-
-const Template: ComponentStory<typeof TextBlockPrimitive> = (args) => (
- <TextBlockPrimitive {...args} />
-);
-
-export const TextBlock = Template.bind({});
-TextBlock.args = {
- children: "text",
-};
diff --git a/packages/sdk-components-react/src/text.stories.tsx b/packages/sdk-components-react/src/text.stories.tsx
new file mode 100644
index 0000000000..8a29c55f3c
--- /dev/null
+++ b/packages/sdk-components-react/src/text.stories.tsx
@@ -0,0 +1,16 @@
+import type { ComponentStory, ComponentMeta } from "@storybook/react";
+import { Text as TextPrimitive } from "./text";
+
+export default {
+ title: "Components/Text",
+ component: TextPrimitive,
+} as ComponentMeta<typeof TextPrimitive>;
+
+const Template: ComponentStory<typeof TextPrimitive> = (args) => (
+ <TextPrimitive {...args} />
+);
+
+export const Text = Template.bind({});
+Text.args = {
+ children: "text",
+};
diff --git a/packages/sdk-components-react/src/text-block.tsx b/packages/sdk-components-react/src/text.tsx
similarity index 80%
rename from packages/sdk-components-react/src/text-block.tsx
rename to packages/sdk-components-react/src/text.tsx
index 58b2833e97..1609b4fa0a 100644
--- a/packages/sdk-components-react/src/text-block.tsx
+++ b/packages/sdk-components-react/src/text.tsx
@@ -12,10 +12,10 @@ type Props = ComponentProps<typeof defaultTag> & {
tag?: "div" | "span" | "figcaption";
};
-export const TextBlock = forwardRef<ElementRef<typeof defaultTag>, Props>(
+export const Text = forwardRef<ElementRef<typeof defaultTag>, Props>(
({ tag = defaultTag, ...props }, ref) => {
return createElement(tag, { ...props, ref });
}
);
-TextBlock.displayName = "TextBlock";
+Text.displayName = "Text";
diff --git a/packages/sdk-components-react/src/text-block.ws.tsx b/packages/sdk-components-react/src/text.ws.tsx
similarity index 67%
rename from packages/sdk-components-react/src/text-block.ws.tsx
rename to packages/sdk-components-react/src/text.ws.tsx
index 47ae315a1f..c969240fa5 100644
--- a/packages/sdk-components-react/src/text-block.ws.tsx
+++ b/packages/sdk-components-react/src/text.ws.tsx
@@ -1,4 +1,4 @@
-import { TextBlockIcon } from "@webstudio-is/icons/svg";
+import { TextIcon } from "@webstudio-is/icons/svg";
import {
defaultStates,
type PresetStyle,
@@ -6,8 +6,8 @@ import {
type WsComponentPropsMeta,
} from "@webstudio-is/react-sdk";
import { div } from "@webstudio-is/react-sdk/css-normalize";
-import { props } from "./__generated__/text-block.props";
-import type { defaultTag } from "./text-block";
+import { props } from "./__generated__/text.props";
+import type { defaultTag } from "./text";
const presetStyle = {
div: [
@@ -22,15 +22,15 @@ const presetStyle = {
export const meta: WsComponentMeta = {
category: "text",
type: "container",
- label: "Text Block",
- icon: TextBlockIcon,
+ label: "Text",
+ icon: TextIcon,
states: defaultStates,
presetStyle,
template: [
{
type: "instance",
- component: "TextBlock",
- children: [{ type: "text", value: "Block of text you can edit" }],
+ component: "Text",
+ children: [{ type: "text", value: "The text you can edit" }],
},
],
order: 0,