generated from TH-Activities/saturday-hack-night-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ui.html
75 lines (59 loc) · 1.79 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
<form >
<h2>Rectangle Creator</h2>
<p>Brand Name: <input class="input" id="name" type="text" value="LOGO" ></p>
<p>Describe your Brand: <input class="input" id="desc" type="text" value="SMAPLE LANDING PAGE"></p>
<p>Primary Color: <input id="pcolor" type="color" ></p>
<p class="hide">Secondary Color: <input id="scolor" type="color" ></p>
</form>
<button id="create">Create</button>
<button id="cancel">Cancel</button>
<script>
document.getElementById('create').onclick = () => {
// Get values from the form fields
const brandName = document.getElementById("name").value;
const brandDescription = document.getElementById("desc").value;
const primaryColor = document.getElementById("pcolor").value;
// const primaryColor = "#7B61FF"
const secondaryColor = document.getElementById("scolor").value;
// Create an object to store the form values
const formData = {
brandName: brandName,
brandDescription: brandDescription,
primaryColor: primaryColor,
secondaryColor: secondaryColor,
};
// You can now use the "formData" object to do further processing or send it to an API, etc.
parent.postMessage({ pluginMessage: { type: 'create', formData } }, '*')
}
document.getElementById('cancel').onclick = () => {
parent.postMessage({ pluginMessage: { type: 'cancel' } }, '*')
}
</script>
<style>
.hide{
display: none;
}
form{
display: flex;
flex-direction: column;
gap: 5px;
}
.input{
width: 80%;
border: 1px solid grey;
border: 1px solid grey;
border-radius: 6px;
padding: 4px ;
display: block;
}
button{
color:white;
background-color: #1677ff;
font-size: 14px;
height: 32px;
padding: 4px 15px;
border: 1px solid transparent;
border-radius: 6px;
margin: 5px;
}
</style>