feat: Wireframe ersellen
This commit is contained in:
51
code.js
51
code.js
@@ -79,6 +79,57 @@ case 'ai-generate':
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'create-wireframe':
|
||||||
|
// Header
|
||||||
|
const header = figma.createRectangle();
|
||||||
|
header.resize(800, 80);
|
||||||
|
header.x = 100;
|
||||||
|
header.y = 100;
|
||||||
|
header.fills = [{ type: 'SOLID', color: { r: 0.9, g: 0.9, b: 0.9 } }];
|
||||||
|
header.name = 'Header';
|
||||||
|
figma.currentPage.appendChild(header);
|
||||||
|
// Header Text
|
||||||
|
const headerText = figma.createText();
|
||||||
|
await figma.loadFontAsync({ family: "Inter", style: "Regular" });
|
||||||
|
headerText.characters = "Header";
|
||||||
|
headerText.x = 120;
|
||||||
|
headerText.y = 130;
|
||||||
|
headerText.fontSize = 32;
|
||||||
|
figma.currentPage.appendChild(headerText);
|
||||||
|
// Content
|
||||||
|
const content = figma.createRectangle();
|
||||||
|
content.resize(800, 400);
|
||||||
|
content.x = 100;
|
||||||
|
content.y = 200;
|
||||||
|
content.fills = [{ type: 'SOLID', color: { r: 0.95, g: 0.95, b: 0.95 } }];
|
||||||
|
content.name = 'Content';
|
||||||
|
figma.currentPage.appendChild(content);
|
||||||
|
// Content Text
|
||||||
|
const contentText = figma.createText();
|
||||||
|
await figma.loadFontAsync({ family: "Inter", style: "Regular" });
|
||||||
|
contentText.characters = "Content";
|
||||||
|
contentText.x = 120;
|
||||||
|
contentText.y = 220;
|
||||||
|
contentText.fontSize = 24;
|
||||||
|
figma.currentPage.appendChild(contentText);
|
||||||
|
// Footer
|
||||||
|
const footer = figma.createRectangle();
|
||||||
|
footer.resize(800, 60);
|
||||||
|
footer.x = 100;
|
||||||
|
footer.y = 620;
|
||||||
|
footer.fills = [{ type: 'SOLID', color: { r: 0.85, g: 0.85, b: 0.85 } }];
|
||||||
|
footer.name = 'Footer';
|
||||||
|
figma.currentPage.appendChild(footer);
|
||||||
|
// Footer Text
|
||||||
|
const footerText = figma.createText();
|
||||||
|
await figma.loadFontAsync({ family: "Inter", style: "Regular" });
|
||||||
|
footerText.characters = "Footer";
|
||||||
|
footerText.x = 120;
|
||||||
|
footerText.y = 640;
|
||||||
|
footerText.fontSize = 20;
|
||||||
|
figma.currentPage.appendChild(footerText);
|
||||||
|
figma.viewport.scrollAndZoomIntoView([header, content, footer]);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
console.log("Unknown message:", msg);
|
console.log("Unknown message:", msg);
|
||||||
|
|||||||
4
ui.html
4
ui.html
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
<button id="create-rect">Create Rectangle</button>
|
<button id="create-rect">Create Rectangle</button>
|
||||||
<button id="create-text">Create Text</button>
|
<button id="create-text">Create Text</button>
|
||||||
|
<button id="create-wireframe">Wireframe erstellen</button>
|
||||||
|
|
||||||
<textarea
|
<textarea
|
||||||
id="ai-prompt"
|
id="ai-prompt"
|
||||||
@@ -51,6 +52,9 @@
|
|||||||
document.getElementById("get-selection").onclick = () => {
|
document.getElementById("get-selection").onclick = () => {
|
||||||
parent.postMessage({ pluginMessage: { type: "get-selection" } }, "*");
|
parent.postMessage({ pluginMessage: { type: "get-selection" } }, "*");
|
||||||
};
|
};
|
||||||
|
document.getElementById("create-wireframe").onclick = () => {
|
||||||
|
parent.postMessage({ pluginMessage: { type: "create-wireframe" } }, "*");
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
document.getElementById("ai-generate").onclick = () => {
|
document.getElementById("ai-generate").onclick = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user