-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2e42ab1
commit bb56ae2
Showing
20 changed files
with
479 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Example | ||
|
||
The module is installed locally. Therefore in order to run it without a problem is being in the package.json under scripts with the name `cli` | ||
|
||
## Run | ||
|
||
``` | ||
yarn run cli <then here all the commands explained in the cli README.md> | ||
``` | ||
|
||
## Convert | ||
|
||
In order to fetch all json contents i run the following. Then i get a new directory under `converted` named `json` with all the global properties | ||
because i expanded the global. | ||
|
||
``` | ||
yarn run cli parseFigmaTokens ./data/figma-tokens.json ./converted/json/ --expand global | ||
``` | ||
|
||
## To code | ||
|
||
The you can see with the below how i can convert the json source files i made to code with the following | ||
|
||
``` | ||
yarn run cli parseJsonToCode ./converted/json/ ./theme/constants/ | ||
``` | ||
|
||
## Final use | ||
|
||
Then you can use files in your theme to link those constants and have typed results. | ||
|
||
Check theme/index.ts for more information on how. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
{ | ||
"sizing": { | ||
"0": { | ||
"value": "0px", | ||
"type": "sizing" | ||
}, | ||
"1": { | ||
"value": "4px", | ||
"type": "sizing" | ||
}, | ||
"2": { | ||
"value": "8px", | ||
"type": "sizing" | ||
} | ||
}, | ||
"lineHeight": { | ||
"1": { | ||
"value": "14", | ||
"type": "lineHeights", | ||
"description": "For form field labels only" | ||
}, | ||
"2": { | ||
"value": "16", | ||
"type": "lineHeights", | ||
"description": "For input fields only (Form Fields & Tables)" | ||
}, | ||
"3": { | ||
"value": "18px", | ||
"type": "lineHeights" | ||
}, | ||
"4": { | ||
"value": "20", | ||
"type": "lineHeights" | ||
} | ||
}, | ||
"fontWeight": { | ||
"regular": { | ||
"value": "Regular", | ||
"type": "fontWeights" | ||
}, | ||
"medium": { | ||
"value": "Medium", | ||
"type": "fontWeights" | ||
}, | ||
"bold": { | ||
"value": "Bold", | ||
"type": "fontWeights" | ||
} | ||
}, | ||
"fontSize": { | ||
"1": { | ||
"value": "12", | ||
"type": "fontSizes" | ||
}, | ||
"2": { | ||
"value": "13", | ||
"type": "fontSizes" | ||
}, | ||
"3": { | ||
"value": "14", | ||
"type": "fontSizes" | ||
} | ||
}, | ||
"spacing": { | ||
"0": { | ||
"value": "0px", | ||
"type": "spacing" | ||
}, | ||
"1": { | ||
"value": "2px", | ||
"type": "spacing" | ||
}, | ||
"2": { | ||
"value": "4px", | ||
"type": "spacing" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"1": { | ||
"value": "12", | ||
"type": "fontSizes" | ||
}, | ||
"2": { | ||
"value": "13", | ||
"type": "fontSizes" | ||
}, | ||
"3": { | ||
"value": "14", | ||
"type": "fontSizes" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"regular": { | ||
"value": "Regular", | ||
"type": "fontWeights" | ||
}, | ||
"medium": { | ||
"value": "Medium", | ||
"type": "fontWeights" | ||
}, | ||
"bold": { | ||
"value": "Bold", | ||
"type": "fontWeights" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"1": { | ||
"value": "14", | ||
"type": "lineHeights", | ||
"description": "For form field labels only" | ||
}, | ||
"2": { | ||
"value": "16", | ||
"type": "lineHeights", | ||
"description": "For input fields only (Form Fields & Tables)" | ||
}, | ||
"3": { | ||
"value": "18px", | ||
"type": "lineHeights" | ||
}, | ||
"4": { | ||
"value": "20", | ||
"type": "lineHeights" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"0": { | ||
"value": "0px", | ||
"type": "sizing" | ||
}, | ||
"1": { | ||
"value": "4px", | ||
"type": "sizing" | ||
}, | ||
"2": { | ||
"value": "8px", | ||
"type": "sizing" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"0": { | ||
"value": "0px", | ||
"type": "spacing" | ||
}, | ||
"1": { | ||
"value": "2px", | ||
"type": "spacing" | ||
}, | ||
"2": { | ||
"value": "4px", | ||
"type": "spacing" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
{ | ||
"global": { | ||
"sizing": { | ||
"0": { | ||
"value": "0px", | ||
"type": "sizing" | ||
}, | ||
"1": { | ||
"value": "4px", | ||
"type": "sizing" | ||
}, | ||
"2": { | ||
"value": "8px", | ||
"type": "sizing" | ||
} | ||
}, | ||
"lineHeight": { | ||
"1": { | ||
"value": "14", | ||
"type": "lineHeights" | ||
}, | ||
"2": { | ||
"value": "16", | ||
"type": "lineHeights" | ||
}, | ||
"3": { | ||
"value": "18px", | ||
"type": "lineHeights" | ||
}, | ||
"4": { | ||
"value": "20", | ||
"type": "lineHeights" | ||
} | ||
}, | ||
"fontWeight": { | ||
"regular": { | ||
"value": "Regular", | ||
"type": "fontWeights" | ||
}, | ||
"medium": { | ||
"value": "Medium", | ||
"type": "fontWeights" | ||
}, | ||
"bold": { | ||
"value": "Bold", | ||
"type": "fontWeights" | ||
} | ||
}, | ||
"fontSize": { | ||
"1": { | ||
"value": "12", | ||
"type": "fontSizes" | ||
}, | ||
"2": { | ||
"value": "13", | ||
"type": "fontSizes" | ||
}, | ||
"3": { | ||
"value": "14", | ||
"type": "fontSizes" | ||
} | ||
}, | ||
"spacing": { | ||
"0": { | ||
"value": "0px", | ||
"type": "spacing" | ||
}, | ||
"1": { | ||
"value": "2px", | ||
"type": "spacing" | ||
}, | ||
"2": { | ||
"value": "4px", | ||
"type": "spacing" | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const fontSize = { | ||
'1': { | ||
value: '12', | ||
type: 'fontSizes', | ||
}, | ||
'2': { | ||
value: '13', | ||
type: 'fontSizes', | ||
}, | ||
'3': { | ||
value: '14', | ||
type: 'fontSizes', | ||
}, | ||
} as const; | ||
|
||
export default fontSize; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const fontWeight = { | ||
regular: { | ||
value: 'Regular', | ||
type: 'fontWeights', | ||
}, | ||
medium: { | ||
value: 'Medium', | ||
type: 'fontWeights', | ||
}, | ||
bold: { | ||
value: 'Bold', | ||
type: 'fontWeights', | ||
}, | ||
} as const; | ||
|
||
export default fontWeight; |
Oops, something went wrong.