// url=https://www.figma.com/design/3WoKOSGtaSjhUHKldHCXbc/Desktop-Components-3?node-id=479-6030&m=dev // Desktop Components 3 // Code Connect cannot expose properties of nested components placed in slots; // slotted markup in the snippet is fixed and Dev Mode will not update it when // nested instance properties change in Figma. import figma from "figma"; const boxType = figma.selectedInstance.getPropertyValue("Type"); let template; if (boxType === "Slot") { const slotContent = figma.selectedInstance.getInstanceSwap("Slot")?.executeTemplate().example ?? `

You can put whatever you want in here! Use your imagination! (Just don't pass other props as they won't work/get overridden by the slot)

`; template = { id: "moz-box-item-desktop-v3", example: figma.code`${slotContent}`, }; } else { const label = figma.selectedInstance.getString("Label"); const iconSrc = figma.selectedInstance.getBoolean("Show icon", { true: "chrome://example.svg", }); const description = figma.selectedInstance.getBoolean("Show description", { true: figma.selectedInstance.getString("Description"), }); const layout = figma.selectedInstance.getEnum("Type", { "Large icon": "large-icon", "Medium icon": "medium-icon", }); const startActions = figma.selectedInstance.getEnum("Type", { "Actions preset": '', "Actions slots": '', }); const endActions = figma.selectedInstance.getEnum("Type", { "Actions preset": '', "Actions slots": '', }); template = { id: "moz-box-item-desktop-v3", example: figma.code` ${startActions ?? ""}${endActions ?? ""} `, }; } export default template;