Skip to content

Commit 47518c0

Browse files
authored
Merge pull request #10 from nus3/form-page
add simple form page
2 parents 90d232d + f6a2737 commit 47518c0

File tree

4 files changed

+140
-0
lines changed

4 files changed

+140
-0
lines changed

src/form/index.html

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>form | nus3 UI Labs</title>
7+
</head>
8+
<body>
9+
<header>
10+
<h1>Form</h1>
11+
</header>
12+
<main>
13+
<form id="myForm" class="form">
14+
<div>
15+
<label for="firstName">First Name</label>
16+
<input type="text" id="firstName" name="firstName" required>
17+
</div>
18+
<div>
19+
<label for="lastName">Last Name</label>
20+
<input type="text" id="lastName" name="lastName" required>
21+
</div>
22+
<div>
23+
<label for="email">Email</label>
24+
<input type="email" id="email" name="email" required>
25+
</div>
26+
<div>
27+
<button type="button" onclick="alert('Form submitted')">Submit</button>
28+
<button type="button" onclick="clearForm()">Clear</button>
29+
</div>
30+
</form>
31+
<footer>
32+
<a href="../">TOP</a>
33+
</footer>
34+
<script type="module" src="./main.js"></script>
35+
<script>
36+
function clearForm() {
37+
document.getElementById('myForm').reset();
38+
}
39+
</script>
40+
</body>
41+
</html>

src/form/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import './style.css'

src/form/style.css

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
:root {
2+
--primary-color: hsl(160 55% 55%);
3+
--primary-color-opacity: hsl(160 55% 55% / 0.6);
4+
--primary-color-opacity-low: hsl(160 55% 55% / 0.2);
5+
--primary-color-hover-opacity: hsl(160 55% 55% / 0.8);
6+
--secondary-color: hsl(42 100% 70%);
7+
--secondary-color-opacity-low: hsl(42 100% 70% / 0.2);
8+
--secondary-color-opacity: hsl(42 100% 70% / 0.2);
9+
--bg-color: hsl(216 18% 16%);
10+
--bg-color-opacity: hsl(216 18% 16% / 0.4);
11+
--bg-light-color: hsl(216 10% 24%);
12+
--button-shadow: 0px 6px 11px 1px rgba(31, 37, 45, 0.6);
13+
--text-color: hsl(0 0% 93%);
14+
}
15+
16+
body {
17+
margin: 0;
18+
margin-bottom: 200px;
19+
background-color: var(--bg-color);
20+
color: var(--text-color);
21+
padding: 2rem;
22+
}
23+
24+
h1 {
25+
color: var(--primary-color);
26+
}
27+
28+
ul {
29+
list-style: none;
30+
}
31+
32+
ul > li {
33+
margin-bottom: 1rem;
34+
}
35+
36+
ul > li:last-child {
37+
margin-bottom: 0;
38+
}
39+
40+
button {
41+
border-radius: 0.25rem;
42+
border-width: 1px;
43+
border-style: solid;
44+
border-color: var(--primary-color);
45+
background-color: var(--primary-color-opacity);
46+
cursor: pointer;
47+
color: inherit;
48+
padding: 0.6rem;
49+
font-size: 1rem;
50+
height: 40px;
51+
}
52+
53+
button:hover {
54+
background-color: var(--primary-color-hover-opacity);
55+
}
56+
57+
footer {
58+
position: fixed;
59+
inset-block-end: 0;
60+
padding: 2rem;
61+
padding-left: 0;
62+
}
63+
64+
a {
65+
color: var(--secondary-color);
66+
font-size: 1.4rem;
67+
}
68+
69+
label {
70+
display: flex;
71+
gap: 0.4rem;
72+
align-items: center;
73+
}
74+
75+
input {
76+
height: 28px;
77+
background-color: var(--secondary-color-opacity-low);
78+
border-radius: 0.25rem;
79+
border-width: 1px;
80+
border-style: solid;
81+
border-color: var(--secondary-color);
82+
color: var(--text-color);
83+
padding: 0.4rem;
84+
font-size: 1.2rem;
85+
}
86+
87+
p {
88+
margin: 0;
89+
}
90+
91+
.form {
92+
display: flex;
93+
flex-direction: column;
94+
gap: 1.2rem;
95+
align-items: center;
96+
margin-bottom: 30px;
97+
}

vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export default defineConfig({
2020
schedulerYield: resolve(root, 'scheduler-yield', 'index.html'),
2121
selectlist: resolve(root, 'selectlist', 'index.html'),
2222
webDriverBidi: resolve(root, 'web-driver-bidi', 'index.html'),
23+
form: resolve(root, 'form', 'index.html'),
2324
},
2425
},
2526
},

0 commit comments

Comments
 (0)