Skip to content

Commit 944b3b1

Browse files
author
Nikos Katsikanis
committed
form imp
1 parent ef96885 commit 944b3b1

File tree

3 files changed

+32
-32
lines changed

3 files changed

+32
-32
lines changed

css/form.css

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
1-
/* Stored in /css/form.css */
2-
31
/*
4-
Good default for form with the form inputs with width: 100%
5-
*/
6-
form.centered {
7-
display: flex;
8-
flex-direction: column;
9-
gap: 1rem;
2+
File: css/form.css
3+
Version: 0.1: Made base form easier to work with devs with labels and form-controls
4+
*/
5+
form {
6+
max-width: 600px;
7+
margin-left: auto;
8+
margin-right: auto;
9+
}
1010

11-
@media screen and (min-width: 600px) {
12-
width: 400px;
13-
margin: 0 auto;
14-
}
11+
form.grid {
12+
display: grid;
13+
/*todo*/
1514
}
1615

1716
input,
1817
textarea {
1918
padding: 0.5rem;
20-
border-radius: 0.75rem;
21-
border: 1px solid var(--default-text);
19+
border-radius: var(--form-control-border-radius);
20+
border: 1px solid var(--form-control-border-color);
2221
color: var(--default-text);
23-
background-color: var(--form-control-bg);
22+
background-color: var(--form-control-bg-color);
2423
width: 100%;
2524
}
25+
26+
:root {
27+
--form-control-border-radius: 4px;
28+
}

css/reset.css

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
/*
2+
File: css/reset.css
23
things that annoy me
3-
*/
4-
/*stored in /css/reset.css*/
5-
4+
*/
65
a {
76
text-decoration: none;
87
}

js/routes/form.js

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,30 @@ export default (hostComponent) => {
77
//language=HTML
88
const indexHTML = `
99
10-
<h1>Form</h1>
10+
<h1>Form examples</h1>
1111
<form class="centered">
12-
<h2>Centered class form</h2>
13-
<span data-component="toggle-switch"></span>
12+
<p>Linear form (repeating divs with label + form control pairs)</p>
1413
<div>
15-
<label for="name">Name</label>
16-
<input type="text" id="name" name="name">
14+
<label for="name" >Name</label>
15+
<input type="text" id="name" name="name" autocomplete="name" required>
1716
</div>
1817
<div>
1918
<label for="password">Password</label>
20-
<input type="password" id="password" name="password">
19+
<input type="password" id="password" name="password" autocomplete="password" required>
2120
</div>
22-
23-
<!-- <div>
24-
<label for="iagree">I agree</label>
25-
<input type="checkbox" name="iagree" id="iagree">
26-
</div>-->
2721
<div>
2822
<label for="date">Date</label>
29-
<input type="date" name="date" id="date">
23+
<input type="date" name="date" id="date" required>
3024
</div>
3125
<div>
3226
<label for="range">Range</label>
33-
<input type="range" name="range" id="range">
27+
<input type="range" name="range" id="range" >
28+
</div>
29+
<div>
30+
<label for="message">message</label>
31+
<textarea name="message" rows="4" required></textarea>
3432
</div>
35-
<textarea id="message" name="message" rows="4" required></textarea>
33+
<span data-component="toggle-switch"></span>
3634
3735
<button type="submit">Submit</button>
3836
</form>

0 commit comments

Comments
 (0)