-
Notifications
You must be signed in to change notification settings - Fork 0
/
ui.html
172 lines (145 loc) · 4.44 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<div class="box">
<p class="description">If you re-size <span class="point">Frame</span>,<br />This Plugin working like <span class="point">Repeat Grid</span> in Adobe XD.</p>
<div class="input-list">
<div class="row">
<p class="label">
<svg viewBox="0 0 32 32" class="icon">
<path class="path" d="m11 22.5v-13h-1v13z"></path>
<path class="path" d="m22 9.5v13h-1v-13z"></path>
<path class="path" d="m17 12.5v7h-2v-7z"></path>
</svg>
Enter the horizontal spacing to set.
</p>
<input type="number" class="input input-column" min="0" value="0" />
</div>
<div class="row">
<p class="label">
<svg viewBox="0 0 32 32" class="icon">
<path class="path" d="m9.5 10h13v1h-13z"></path>
<path class="path" d="m12.5 15h7v2h-7z"></path>
<path class="path" d="m22.5 21h-13v1h13z"></path>
</svg>
Enter the vertical spacing to set.
</p>
<input type="number" class="input input-row" min="0" value="0" />
</div>
<div class="row">
<p class="label"><span class="big">Limit</span> Enter the maximun Object count.</p>
<input type="number" class="input input-limit" min="0" />
</div>
</div>
<!-- <button class="btn-apply">Apply</button> -->
</div>
<script>
// document.querySelector(".btn-apply").addEventListener("click", () => {});
document.querySelector(".input-column").addEventListener("keyup", sendData);
document.querySelector(".input-row").addEventListener("keyup", sendData);
document.querySelector(".input-limit").addEventListener("keyup", sendData);
function sendData() {
const col = document.querySelector(".input-column");
const row = document.querySelector(".input-row");
const limit = document.querySelector(".input-limit");
const data = {
col: Number(col.value),
row: Number(row.value),
limit: Number(limit.value),
};
if (data.col < 0) {
data.col = data.col * -1;
col.value = data.col;
}
if (data.row < 0) {
data.row = data.row * -1;
row.value = data.row;
}
if (data.limit < 0) {
data.limit = data.limit * -1;
limit.value = data.limit;
}
parent.postMessage({ pluginMessage: { type: "apply", data } }, "*");
}
// 데이터 수신
window.onmessage = (event) => {
if (event.data.pluginMessage !== "") {
const data = event.data.pluginMessage;
document.querySelector(".input-column").value = data.col;
document.querySelector(".input-row").value = data.row;
sendData();
}
};
</script>
<style>
body {
margin: 0;
font-family: "Inter", sans-serif;
}
p {
margin: 0;
}
.box {
display: flex;
flex-direction: column;
row-gap: 20px;
padding: 20px;
}
.description {
font-size: 14px;
font-weight: bold;
line-height: 1.5;
}
.description .point {
color: #37c66b;
font-weight: 900;
}
.input-list {
display: flex;
flex-direction: column;
row-gap: 16px;
}
.input-list .label {
display: flex;
align-items: center;
column-gap: 4px;
margin-bottom: 4px;
color: #949494;
font-size: 12px;
}
.input-list .label .big {
color: #37c66b;
font-size: 14px;
font-weight: bold;
}
.input-list .label .icon {
width: 18px;
height: 18px;
}
.input-list .label .path {
fill: #38c66b;
}
.input-list .input {
width: 100%;
height: 37px;
padding: 8px 12px;
background: #fff;
border: 1px solid #cae3cb;
border-radius: 5px;
font-size: 14px;
outline: 0;
}
.btn-apply {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 45px;
background: #38c66b;
color: #fff;
border: 0;
border-radius: 5px;
font-size: 14px;
font-weight: bold;
}
.btn-apply:active {
background: #27b65a;
}
</style>