Skip to content

Commit

Permalink
Merge pull request #32 from ubie-oss/add-radius
Browse files Browse the repository at this point in the history
Add radius token
  • Loading branch information
takanorip committed Oct 19, 2022
2 parents 0160487 + 06e17f5 commit 86918cf
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "@ubie/design-tokens",
"version": "0.1.2",
"version": "0.1.3",
"description": "Ubie Design Tokens",
"style": "dist/tokens.css",
"main": "dist/tokens.js",
Expand Down
20 changes: 19 additions & 1 deletion scripts/figma.js
Expand Up @@ -6,7 +6,6 @@ const writeFile = promisify(fs.writeFile);

const TOKEN = process.env.FIGMA_TOKEN;
const FIGMA_FILE_KEY = process.env.FIGMA_DESIGN_TOKEN_FILE_KEY;
const PREFIX = 'ubie';
const ROOT_FONT_SIZE = 16;

const fetchFigma = (path) =>
Expand Down Expand Up @@ -150,10 +149,29 @@ const main = async () => {
},
});

// Generate Radius tokens
const radius = {};
Object.values(componentNodes)
.filter(({ document }) => document.name.includes('Radius'))
.forEach(({ document }) => {
const name = document.name.split('/')[1].toLowerCase();
const value = document.cornerRadius;
radius[name] = {
value: `${value}px`,
};
});

const radiusContent = JSON.stringify({
radius: {
...radius,
},
});

await writeFile(path.resolve(__dirname, '../tokens/color/primitive.json'), primitiveColorContent);
await writeFile(path.resolve(__dirname, '../tokens/color/semantics.json'), semanticsColorContent);
await writeFile(path.resolve(__dirname, '../tokens/size/spacing.json'), spacingContent);
await writeFile(path.resolve(__dirname, '../tokens/text/typography.json'), typographyContent);
await writeFile(path.resolve(__dirname, '../tokens/size/radius.json'), radiusContent);
console.log('DONE');
};

Expand Down
1 change: 1 addition & 0 deletions tokens/size/radius.json
@@ -0,0 +1 @@
{"radius":{"md":{"value":"8px"},"full":{"value":"9999px"},"sm":{"value":"4px"},"lg":{"value":"12px"},"xs":{"value":"2px"}}}
2 changes: 1 addition & 1 deletion tokens/size/spacing.json
@@ -1 +1 @@
{"size":{"spacing-lg":{"value":1.5,"attributes":{"note":"24px"}},"spacing-xxl":{"value":4,"attributes":{"note":"64px"}},"spacing-xl":{"value":2.5,"attributes":{"note":"40px"}},"spacing-sm":{"value":0.75,"attributes":{"note":"12px"}},"spacing-md":{"value":1,"attributes":{"note":"16px"}},"spacing-xs":{"value":0.5,"attributes":{"note":"8px"}},"spacing-xxs":{"value":0.25,"attributes":{"note":"4px"}}}}
{"size":{"spacing-xxl":{"value":4,"attributes":{"note":"64px"}},"spacing-xs":{"value":0.5,"attributes":{"note":"8px"}},"spacing-xxs":{"value":0.25,"attributes":{"note":"4px"}},"spacing-md":{"value":1,"attributes":{"note":"16px"}},"spacing-lg":{"value":1.5,"attributes":{"note":"24px"}},"spacing-xl":{"value":2.5,"attributes":{"note":"40px"}},"spacing-sm":{"value":0.75,"attributes":{"note":"12px"}}}}

0 comments on commit 86918cf

Please sign in to comment.