Skip to content

Instantly share code, notes, and snippets.

@drunewin
Forked from ryanlucas/SketchSystems.spec
Last active July 15, 2020 03:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drunewin/38db28b0edf9b1951a3d3109b04d9637 to your computer and use it in GitHub Desktop.
Save drunewin/38db28b0edf9b1951a3d3109b04d9637 to your computer and use it in GitHub Desktop.
Embedding Figma frames*
Embedding Figma frames*
Default*
click Tickets -> Tickets
Tickets
click Shop -> Shop
// Attach Figma frames (artboards) to states
// IDs can be found under "Share > Public Embed" in Figma
// ** Edit this: Figma File ID
const figmaFile = "SKGZXTY40fT7sQJs4h6jWx";
// ** Edit this: List state names and matching Figma frame/artboard IDs
const figmaNodes =
{Default: "1%253A",
Tickets: "0%3A53" };
const figmaURL = "https://www.figma.com/embed?embed_host=share&url=https://www.figma.com/file/" + figmaFile + "/Sample-File?node-id=";
function render(model){
const currentStateName = model.active_states[0].name;
for (f in figmaNodes)
if (currentStateName === f)
return $("iframe",{src: figmaURL + figmaNodes[f], width: '100%', height: '100%'});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment