Last active
October 23, 2024 12:51
-
-
Save ryanlucas/a58505b25ac114c6cec64922cb8fb325 to your computer and use it in GitHub Desktop.
Embedding Figma frames
This file contains hidden or 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
Embedding Figma frames | |
Shop | |
click Tickets -> Tickets | |
Tickets | |
click Shop -> Shop | |
This file contains hidden or 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
// Attach Figma frames (artboards) to states | |
// IDs can be found under "Share > Public Embed" in Figma | |
// ** Edit this: Figma File ID | |
const figmaFile = "9YIyKtFdtZ1Rad2xIdjMB9"; | |
// ** Edit this: List state names and matching Figma frame/artboard IDs | |
const figmaNodes = | |
{Shop: "0%3A197", | |
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