-
Notifications
You must be signed in to change notification settings - Fork 0
/
ui.html
85 lines (75 loc) · 1.88 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
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/gh/thomas-lowry/figma-plugin-ds/dist/figma-plugin-ds.css"
/>
<style>
body {
padding: 1em;
}
input {
display: block;
}
textarea {
width: 100%;
display: block;
}
</style>
<h1>Custom Color Data Generator ver.0.2.1</h1>
<div>
<h2>file type</h2>
<div class="radio">
<input
id="radioButton1"
type="radio"
class="radio__button"
name="filetype"
value="JSON"
checked
/>
<label for="radioButton1" class="radio__label">JSON</label>
<input
id="radioButton2"
type="radio"
class="radio__button"
name="filetype"
value="XML"
/>
<label for="radioButton2" class="radio__label">XML</label>
<input
id="radioButton3"
type="radio"
class="radio__button"
name="filetype"
value="CSS"
/>
<label for="radioButton3" class="radio__label">CSS</label>
</div>
<div>
<button class="button button--primary" id="submit-create">Generate</button>
</div>
<div>
<label for="output-area">CODES</label>
<textarea rows="10" id="output-area"></textarea>
</div>
</div>
<script>
const codeOutPutArea = document.getElementById("output-area");
const createButton = document.getElementById("submit-create");
console.log(createButton);
// 処理を受け取って表示する
window.addEventListener("message",(event) => {
const message = event.data.pluginMessage
switch (message.type) {
case "render":
console.log(message.body)
codeOutPutArea.innerHTML = message.body;
break
}
})
// Generateボタンが押されたら処理を渡す
createButton.addEventListener('click', () => {
const fileType = document.querySelector('input[name="filetype"]:checked').value;
console.log(fileType);
parent.postMessage({pluginMessage: {fileType}}, '*');
})
</script>