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.

line-height migration script

Oleg Isonen0328035c5e5f
diff --git a/codemod/migrate-tokens.ts b/codemod/migrate-tokens.ts
index 1c16d3a120..6d394c3b9a 100644
--- a/codemod/migrate-tokens.ts
+++ b/codemod/migrate-tokens.ts
@@ -191,6 +191,13 @@ const fontSizeValues = new Map([
["14px", "4"],
]);
+const lineHeightProps = ["lineHeight"];
+const lineHeightValues = new Map([
+ ["15px", "$3"],
+ ["16px", "$3"],
+ ["20px", "$4"],
+]);
+
const updateProperty = (
line: string,
props: Array<string>,
@@ -226,6 +233,12 @@ const update = async ({ filePath, buffer }) => {
for (line of lines) {
line = updateProperty(line, spaceProps, spaceValues, "spacing");
line = updateProperty(line, fontSizeProps, fontSizeValues, "fontSize");
+ line = updateProperty(
+ line,
+ lineHeightProps,
+ lineHeightValues,
+ "lineHeight"
+ );
nextLines.push(line);
}
await fs.writeFile(filePath, nextLines.join("\n"));
diff --git a/packages/design-system/src/stitches.config.ts b/packages/design-system/src/stitches.config.ts
index 410b4e9702..252e268db5 100644
--- a/packages/design-system/src/stitches.config.ts
+++ b/packages/design-system/src/stitches.config.ts
@@ -266,6 +266,13 @@ const {
8: "35px",
9: "59px",
},
+ lineHeight: {
+ 1: "8px",
+ 2: "12px",
+ 3: "16px",
+ // Legacy - don't use unless specified in Figma
+ 4: "20px",
+ },
radii: {
1: "4px",
2: "6px",