-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui.html
98 lines (93 loc) · 2.28 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
<style>
* {
margin: 0;
box-sizing: border-box;
}
body {
font-family: Arial, Helvetica, sans-serif;
margin: 20px;
}
h2 {
text-align: center;
margin-bottom: 20px;
}
textarea {
border: 1px solid #eee;
border-radius: 4px;
width: 100%;
height: 300px;
resize: none;
font-family: monospace;
padding: 8px;
outline: none;
border: 2px solid #eee;
margin-bottom: 20px;
font-size: 14px;
}
textarea::selection {
background: transparent;
}
button {
display: flex;
align-items: center;
gap: 0 8px;
border: none;
height: 32px;
padding: 0 8px;
border-radius: 4px;
background-color: #3d61e5;
color: white;
cursor: pointer;
}
.actions {
display: flex;
gap: 20px;
justify-content: center;
margin-bottom: 30px;
}
p, a {
font-size: 12px;
text-align: center;
font-family: monospace;
}
</style>
<div>
<h2>SCSS Auto Mixin And Color</h2>
<textarea readonly></textarea>
<div class="actions">
<button id="create-text-type">Create Text Type</button>
<button id="create-color">Create Color</button>
<button id="copy">
<svg fill="#fff" height="16" width="16" viewBox="0 0 422 422">
<g>
<polygon points="291,0 51,0 51,332 121,332 121,80 291,80 "/>
<polygon points="306,125 306,195 376,195 "/>
<polygon points="276,225 276,110 151,110 151,442 391,442 391,225 "/>
</g>
</svg>
<span>Copy</span>
</button>
</div>
<p>with love ♥️ <a href="https://twitter.com/emreeakdas" target="_blank">@emreeakdas</a></p>
</div>
<script>
document.getElementById('create-text-type').addEventListener("click", () => {
parent.postMessage({ pluginMessage: "create-text-type"}, '*');
});
document.getElementById('create-color').addEventListener("click", () => {
parent.postMessage({ pluginMessage: "create-color"}, '*');
});
document.getElementById('copy').addEventListener("click", () => {
const textarea = document.querySelector("textarea");
if(!textarea.value){
alert("Create Text Type or Color!");
}else {
textarea.select();
document.execCommand('copy');
alert("Copied!");
}
});
onmessage = (event) => {
document.querySelector("textarea").value = event.data.pluginMessage;
}
</script>