Skip to content

Instantly share code, notes, and snippets.

@johnkazer
Last active August 23, 2019 21:15
Show Gist options
  • Save johnkazer/3c6953347333c095b67f3215559d821b to your computer and use it in GitHub Desktop.
Save johnkazer/3c6953347333c095b67f3215559d821b to your computer and use it in GitHub Desktop.
Reviewing CT Style
Reviewing CT Style
Colours
click -> Process
Colour_1 -> Info_1
Process
click -> Colours
Info_1
return -> Colours
// CT Style
const figmaFile = "PtNa26Kz79mEK8LQ7X47VD";
// ** Edit this: List state names and matching frame IDs
const nodes =
[
{
"name": "Colours",
"id": "1:3"
},
{
"name": "Frame",
"id": "1:4"
},
{
"name": "Process",
"id": "6:12"
}
]
const figmaURL = "https://www.figma.com/embed?embed_host=share&url=https://www.figma.com/file/" + figmaFile + "/Sample-File?node-id=";
const extractId = name => nodes.find(node => node.name === name)
function render(model){
const currentStateName = model.active_states[0].name;
const node = extractId(currentStateName)
const id = node ? node.id : ''
return $("iframe",{src: figmaURL + escape(id), width: '100%', height: '100%'});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment