-
Notifications
You must be signed in to change notification settings - Fork 0
/
ui.html
90 lines (81 loc) · 1.92 KB
/
ui.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<style>
:root {
--spacing: 0.8rem;
}
* {
box-sizing: border-box;
}
body {
background-color: var(--figma-color-bg);
color: var(--figma-color-text);
margin: 0;
padding: var(--spacing);
}
html,
body,
main {
height: 100%;
}
main {
display: flex;
flex-direction: column;
gap: var(--spacing);
}
button {
appearance: none;
border-radius: 4px;
padding: var(--spacing);
}
textarea {
background-color: var(--figma-color-bg-secondary);
border: 2px solid var(--figma-color-border);
color: var(--figma-color-text-primary);
flex: 1;
font-family: Andale Mono, monospace;
font-size: 0.9rem;
overflow: auto;
padding: var(--spacing);
white-space: pre;
}
textarea:focus {
border-color: var(--figma-color-border-selected);
}
button,
textarea {
display: block;
width: 100%;
}
button {
background-color: var(--figma-color-bg-brand);
border: none;
color: var(--figma-color-text-onbrand);
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue",
sans-serif;
font-weight: bold;
}
button:hover {
background-color: var(--figma-color-bg-brand-hover);
color: var(--figma-color-text-onbrand-hover);
}
</style>
<main>
<button id="export" type="button">Export Variables</button>
<textarea
placeholder="Exported variables will render here..."
readonly
></textarea>
</main>
<script>
window.onmessage = ({ data: { pluginMessage } }) => {
if (pluginMessage.type === "EXPORT_RESULT") {
const textarea = document.querySelector("textarea");
textarea.innerHTML = pluginMessage.css;
textarea.focus();
textarea.select();
}
};
document.getElementById("export").addEventListener("click", () => {
parent.postMessage({ pluginMessage: { type: "EXPORT" } }, "*");
});
</script>