├── .DS_Store
├── signup-1
├── .DS_Store
├── bbblurry.svg
├── main.js
├── index.html
├── show.svg
├── hide.svg
└── styles.css
├── signup-2
├── .DS_Store
├── bbblurry.svg
├── index.html
├── show.svg
├── main.js
├── hide.svg
└── styles.css
├── signup-3
├── .DS_Store
├── main.js
├── styles.css
├── index.html
├── 3.svg
├── 2.svg
└── 1.svg
├── README.md
└── signup-4
├── main.js
├── show.svg
├── index.html
├── hide.svg
├── styles.css
└── logo.svg
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/frontend-joe/es6-signups/HEAD/.DS_Store
--------------------------------------------------------------------------------
/signup-1/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/frontend-joe/es6-signups/HEAD/signup-1/.DS_Store
--------------------------------------------------------------------------------
/signup-2/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/frontend-joe/es6-signups/HEAD/signup-2/.DS_Store
--------------------------------------------------------------------------------
/signup-3/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/frontend-joe/es6-signups/HEAD/signup-3/.DS_Store
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ES6-Logins
2 |
3 | Assortment of login forms, showcasing various techniques with ES6
4 |
5 | ### Examples
6 |
7 | - /login-1 - Password Visibility Button
8 |
9 | ### Usage
10 |
11 | To run the project:
12 |
13 | 1. Open each example folder (separately from main project)
14 | 2. Install VS Code LiveServer Plugin
15 | 3. Smash the "Go Live" button
16 |
17 | ### Support
18 |
19 | Hit me up on [Instagram](https://instagram.com/frontendjoe/) if you need any support :)
20 |
--------------------------------------------------------------------------------
/signup-4/main.js:
--------------------------------------------------------------------------------
1 | const setCaret = (el) => {
2 | if (!el) return;
3 |
4 | try {
5 | const range = document.createRange();
6 | const sel = window.getSelection();
7 |
8 | range.setStart(el.childNodes[0], el.innerText.length);
9 | range.collapse(true);
10 |
11 | sel.removeAllRanges();
12 | sel.addRange(range);
13 | } catch (err) {
14 | console.log("Error Setting Caret: ", err);
15 | }
16 | };
17 |
18 | const togglePassword = (button) => {
19 | button.classList.toggle("showing");
20 | const input = document.getElementById("password");
21 | input.type = input.type === "password" ? "text" : "password";
22 | input.focus();
23 | setCaret(input);
24 | };
25 |
--------------------------------------------------------------------------------
/signup-3/main.js:
--------------------------------------------------------------------------------
1 | const swiper = new Swiper(".swiper", {
2 | // Optional parameters
3 | speed: 500,
4 | allowTouchMove: false,
5 | });
6 |
7 | const gotoSlide = (index) => {
8 | swiper.slideTo(index);
9 | };
10 |
11 | const restart = () => {
12 | const inputs = document.querySelectorAll("input");
13 | const buttons = document.querySelectorAll("button[type=button]");
14 |
15 | buttons.forEach((button) => {
16 | button.disabled = true;
17 | });
18 |
19 | inputs.forEach((input) => {
20 | input.value = "";
21 | });
22 |
23 | gotoSlide(0);
24 | };
25 |
26 | const checkValid = (event) => {
27 | event.target.nextElementSibling.disabled = !event.target.value.length;
28 | };
29 |
--------------------------------------------------------------------------------
/signup-1/bbblurry.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/signup-2/bbblurry.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/signup-1/main.js:
--------------------------------------------------------------------------------
1 | const usernames = ["david", "david1", "david2"];
2 |
3 | const spinner = document.getElementById("spinner"),
4 | alert = document.getElementById("alert");
5 |
6 | const updateUi = (value) => {
7 | console.log("value", value);
8 | spinner.classList.remove("visible");
9 |
10 | const usernameExists = usernames.some((u) => u === value);
11 |
12 | console.log("usernames", usernames);
13 | console.log("usernameExists", usernameExists);
14 |
15 | if (usernameExists) {
16 | alert.classList.add("visible");
17 | } else {
18 | alert.classList.remove("visible");
19 | }
20 | };
21 |
22 | const debounce = (callback, time) => {
23 | let interval;
24 | return (...args) => {
25 | clearTimeout(interval);
26 | interval = setTimeout(() => {
27 | callback.apply(null, args);
28 | }, time);
29 | };
30 | };
31 |
32 | const handleStartTyping = () => {
33 | spinner.classList.add("visible");
34 | };
35 |
36 | const handleChange = debounce((input) => {
37 | const { value } = input.target;
38 |
39 | updateUi(value);
40 | }, 500);
41 |
--------------------------------------------------------------------------------
/signup-1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Login 1
5 |
6 |
7 |
8 |
9 |

12 |
Login
13 |
Enter your credentials
14 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/signup-2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Signup 2
5 |
6 |
7 |
8 |
9 |

12 |
Sign Up
13 |
Enter your credentials
14 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/signup-1/show.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/signup-2/show.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/signup-4/show.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/signup-4/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Sign Up 4
5 |
6 |
7 |
8 |
12 |
13 |
14 |
15 |

16 |
Sign Up
17 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/signup-2/main.js:
--------------------------------------------------------------------------------
1 | const bars = document.querySelector("#bars"),
2 | strengthDiv = document.querySelector("#strength"),
3 | passwordInput = document.querySelector("#password");
4 |
5 | const strength = {
6 | 1: "weak",
7 | 2: "medium",
8 | 3: "strong",
9 | };
10 |
11 | const getIndicator = (password, strengthValue) => {
12 | for (let index = 0; index < password.length; index++) {
13 | let char = password.charCodeAt(index);
14 | if (!strengthValue.upper && char >= 65 && char <= 90) {
15 | strengthValue.upper = true;
16 | } else if (!strengthValue.numbers && char >= 48 && char <= 57) {
17 | strengthValue.numbers = true;
18 | } else if (!strengthValue.lower && char >= 97 && char <= 122) {
19 | strengthValue.lower = true;
20 | }
21 | }
22 |
23 | let strengthIndicator = 0;
24 |
25 | for (let metric in strengthValue) {
26 | if (strengthValue[metric] === true) {
27 | strengthIndicator++;
28 | }
29 | }
30 |
31 | return strength[strengthIndicator] ?? "";
32 | };
33 |
34 | const getStrength = (password) => {
35 | let strengthValue = {
36 | upper: false,
37 | numbers: false,
38 | lower: false,
39 | };
40 |
41 | return getIndicator(password, strengthValue);
42 | };
43 |
44 | const handleChange = () => {
45 | let { value: password } = passwordInput;
46 |
47 | console.log(password);
48 |
49 | const strengthText = getStrength(password);
50 |
51 | bars.classList = "";
52 |
53 | if (strengthText) {
54 | strengthDiv.innerText = `${strengthText} Password`;
55 | bars.classList.add(strengthText);
56 | } else {
57 | strengthDiv.innerText = "";
58 | }
59 | };
60 |
--------------------------------------------------------------------------------
/signup-1/hide.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/signup-2/hide.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/signup-4/hide.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/signup-3/styles.css:
--------------------------------------------------------------------------------
1 | html,
2 | body {
3 | height: 100%;
4 | }
5 |
6 | * {
7 | box-sizing: border-box;
8 | }
9 |
10 | body {
11 | margin: 0;
12 | display: grid;
13 | place-items: center;
14 | background: #faf8ff;
15 | font-family: "Euclid Circular A";
16 | text-align: center;
17 | }
18 |
19 | .card {
20 | display: flex;
21 | flex-direction: column;
22 | width: 360px;
23 | height: 490px;
24 | padding: 80px 0 0;
25 | border-radius: 10px;
26 | background: #ffffff;
27 | box-shadow: 0 20px 150px rgb(0 0 0 / 5%);
28 | }
29 |
30 | img {
31 | margin: 0 auto 30px;
32 | width: 140px;
33 | height: 140px;
34 | object-fit: contain;
35 | }
36 |
37 | h2 {
38 | color: #2f2e41;
39 | margin: 0 0 6px;
40 | }
41 |
42 | h3 {
43 | color: #69687a;
44 | margin: 0 0 24px;
45 | font-weight: 400;
46 | font-size: 14px;
47 | align-self: stretch;
48 | }
49 |
50 | input,
51 | button {
52 | display: block;
53 | height: 48px;
54 | width: 270px;
55 | margin: 0 40px;
56 | border-radius: 4px;
57 | font-size: 16px;
58 | font-family: inherit;
59 | outline: none;
60 | text-align: center;
61 | }
62 |
63 | input {
64 | border-width: 1px;
65 | border-color: rgba(0, 0, 0, 0.16);
66 | padding: 12px;
67 | margin-bottom: 8px;
68 | }
69 |
70 | input::placeholder {
71 | color: rgba(0, 0, 0, 0.24);
72 | }
73 |
74 | button {
75 | background: #9563ff;
76 | color: #f9f9f9;
77 | border: 0;
78 | cursor: pointer;
79 | transition: 0.175s;
80 | }
81 |
82 | button:disabled {
83 | background: #e1e0e8;
84 | color: #bbbac5;
85 | cursor: not-allowed;
86 | }
87 |
88 | button.secondary {
89 | background: transparent;
90 | color: #7e7d8a;
91 | }
92 |
93 | button[type="submit"] {
94 | margin-bottom: 8px;
95 | }
96 |
97 | .swiper {
98 | width: 100%;
99 | }
100 |
--------------------------------------------------------------------------------
/signup-3/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Signup 3
8 |
9 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |

23 |
Welcome
24 |
Let's create your username
25 |
31 |
32 |
33 |
34 |
35 |

36 |
37 |
Security
38 |
Enter a strong password
39 |
44 |
45 |
46 |
47 |
48 |

49 |
50 |
Finish
51 |
You're all good to go
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/signup-4/styles.css:
--------------------------------------------------------------------------------
1 | * {
2 | box-sizing: border-box;
3 | }
4 |
5 | html,
6 | body,
7 | .wrapper {
8 | height: 100%;
9 | }
10 |
11 | @keyframes rotate {
12 | 100% {
13 | background-position: 0% 50%;
14 | }
15 | }
16 |
17 | body {
18 | display: grid;
19 | place-items: center;
20 | margin: 0;
21 | background: #e8f2f7;
22 | font-family: "Euclid Circular A", "Poppins";
23 | color: #3a334e;
24 | animation: rotate 1s infinite alternate linear;
25 | }
26 |
27 | button {
28 | background: transparent;
29 | border: 0;
30 | cursor: pointer;
31 | }
32 |
33 | .control {
34 | border: 0;
35 | outline: none;
36 | width: 100%;
37 | height: 56px;
38 | padding: 0 56px 0 16px;
39 | border-radius: 6px;
40 | background: #f4f5f7;
41 | color: #5a4f79;
42 | font-family: inherit;
43 | font-size: 18px;
44 | transition: 0.4s;
45 | }
46 |
47 | .control:focus {
48 | border-color: rgb(0 0 0 / 30%);
49 | }
50 |
51 | .card {
52 | width: 400px;
53 | padding: 60px 30px 38px;
54 | border-radius: 1.25rem;
55 | background: #ffffff;
56 | text-align: center;
57 | }
58 |
59 | .card > img {
60 | width: 240px;
61 | margin-bottom: 20px;
62 | }
63 |
64 | .card > h2 {
65 | font-size: 36px;
66 | font-weight: 600;
67 | margin: 0 0 30px;
68 | }
69 |
70 | .form {
71 | width: 100%;
72 | margin: 0;
73 | display: grid;
74 | gap: 16px;
75 | }
76 |
77 | .form input.control::placeholder {
78 | color: #aaa7bc;
79 | }
80 |
81 | .form > button.control {
82 | cursor: pointer;
83 | width: 100%;
84 | height: 56px;
85 | padding: 0 16px;
86 | background: #1c98dd;
87 | color: #f9f9f9;
88 | border: 0;
89 | border-radius: 6px;
90 | font-family: inherit;
91 | font-size: 16px;
92 | font-weight: 600;
93 | text-align: center;
94 | text-transform: uppercase;
95 | letter-spacing: 2px;
96 | transition: all 0.375s;
97 | }
98 |
99 | .password {
100 | position: relative;
101 | }
102 |
103 | .toggle {
104 | position: absolute;
105 | top: 50%;
106 | right: 16px;
107 | translate: 0 -50%;
108 | width: 30px;
109 | height: 30px;
110 | background-image: url("show.svg");
111 | background-size: 85%;
112 | background-position: center;
113 | background-repeat: no-repeat;
114 | }
115 |
116 | .toggle.showing {
117 | background-image: url("hide.svg");
118 | }
119 |
--------------------------------------------------------------------------------
/signup-1/styles.css:
--------------------------------------------------------------------------------
1 | * {
2 | box-sizing: border-box;
3 | }
4 |
5 | html,
6 | body,
7 | .wrapper {
8 | height: 100%;
9 | }
10 |
11 | @keyframes rotate {
12 | 100% {
13 | background-position: 0% 50%;
14 | }
15 | }
16 |
17 | body {
18 | display: grid;
19 | place-items: center;
20 | margin: 0;
21 | background-color: #000000;
22 | background-image: url("bbblurry.svg");
23 | background-repeat: no-repeat;
24 | background-size: 200vh;
25 | font-family: "Euclid Circular A";
26 | color: #3a334e;
27 | animation: rotate 5s infinite alternate linear;
28 | }
29 |
30 | button {
31 | background: transparent;
32 | border: 0;
33 | cursor: pointer;
34 | }
35 |
36 | .control {
37 | border: 0;
38 | border-radius: 8px;
39 | outline: none;
40 | width: 100%;
41 | height: 56px;
42 | padding: 0 16px;
43 | background: transparent;
44 | border-radius: 6px;
45 | border: 1px solid rgba(255, 255, 255, 0.2);
46 | color: #5a4f79;
47 | margin: 8px 0;
48 | font-family: inherit;
49 | text-align: left;
50 | font-size: 16px;
51 | transition: 0.4s;
52 | }
53 |
54 | .login-card {
55 | width: 400px;
56 | padding: 100px 30px 64px;
57 | border-radius: 1.25rem;
58 | background: rgba(0, 0, 0, 0.5);
59 | text-align: center;
60 | backdrop-filter: blur(10px);
61 | }
62 |
63 | .login-card > h2 {
64 | font-size: 36px;
65 | font-weight: 600;
66 | margin: 0 0 6px;
67 | color: #f9f9f9;
68 | }
69 |
70 | .login-card img {
71 | width: 120px;
72 | border-radius: 50%;
73 | border: 1px solid rgba(255, 255, 255, 0.4);
74 | padding: 5px;
75 | }
76 |
77 | .login-card > h3 {
78 | color: #837f90;
79 | margin: 0 0 40px;
80 | font-weight: 500;
81 | font-size: 1rem;
82 | }
83 |
84 | .login-form {
85 | width: 100%;
86 | margin: 0;
87 | display: grid;
88 | }
89 |
90 | .login-form input.control::placeholder {
91 | color: #aaa7bc;
92 | }
93 |
94 | .login-form > button.control {
95 | cursor: pointer;
96 | width: 100%;
97 | height: 56px;
98 | padding: 0 16px;
99 | background: #f9f9f9;
100 | color: #000000;
101 | border: 0;
102 | font-family: inherit;
103 | font-size: 1rem;
104 | font-weight: 600;
105 | text-align: center;
106 | letter-spacing: 2px;
107 | transition: all 0.375s;
108 | }
109 |
110 | .username {
111 | position: relative;
112 | }
113 |
114 | @keyframes spin {
115 | 100% {
116 | rotate: 1turn;
117 | }
118 | }
119 |
120 | .spinner {
121 | position: absolute;
122 | top: 50%;
123 | right: 16px;
124 | translate: 0 -50%;
125 | width: 24px;
126 | height: 24px;
127 | border-radius: 50%;
128 | border: 3px solid #ccc9e1;
129 | border-top-color: #8f44fd;
130 | opacity: 0;
131 | animation: spin 1s infinite linear;
132 | }
133 |
134 | .spinner.visible {
135 | opacity: 1;
136 | }
137 |
138 | .alert {
139 | overflow: hidden;
140 | text-align: left;
141 | padding: 0 16px;
142 | color: #ff3e72;
143 | height: 0;
144 | transition: 0.3s;
145 | }
146 |
147 | .alert.visible {
148 | height: 32px;
149 | }
150 |
--------------------------------------------------------------------------------
/signup-2/styles.css:
--------------------------------------------------------------------------------
1 | * {
2 | box-sizing: border-box;
3 | }
4 |
5 | html,
6 | body,
7 | .wrapper {
8 | height: 100%;
9 | }
10 |
11 | @keyframes rotate {
12 | 100% {
13 | background-position: 0% 50%;
14 | }
15 | }
16 |
17 | body {
18 | display: grid;
19 | place-items: center;
20 | margin: 0;
21 | background-color: #000000;
22 | background-image: url("bbblurry.svg");
23 | background-repeat: no-repeat;
24 | background-size: 200vh;
25 | font-family: "Euclid Circular A";
26 | color: #868b94;
27 | animation: rotate 5s infinite alternate linear;
28 | }
29 |
30 | button {
31 | background: transparent;
32 | border: 0;
33 | cursor: pointer;
34 | }
35 |
36 | .control {
37 | border: 0;
38 | border-radius: 8px;
39 | outline: none;
40 | width: 100%;
41 | height: 56px;
42 | padding: 0 16px;
43 | background: rgba(255, 255, 255, 0.1);
44 | border-radius: 6px;
45 | color: #f9f9f9;
46 | margin: 8px 0;
47 | font-family: inherit;
48 | text-align: left;
49 | font-size: 16px;
50 | transition: 0.4s;
51 | }
52 |
53 | .login-card {
54 | width: 400px;
55 | padding: 100px 30px 32px;
56 | border-radius: 1.25rem;
57 | background: rgba(0, 0, 0, 0.7);
58 | backdrop-filter: blur(26px);
59 | text-align: center;
60 | }
61 |
62 | .login-card > h2 {
63 | font-size: 36px;
64 | font-weight: 600;
65 | margin: 0 0 6px;
66 | color: #f9f9f9;
67 | }
68 |
69 | .login-card img {
70 | width: 120px;
71 | border-radius: 50%;
72 | border: 1px solid rgba(255, 255, 255, 0.4);
73 | padding: 5px;
74 | margin-bottom: 20px;
75 | }
76 |
77 | .login-card > h3 {
78 | color: #837f90;
79 | margin: 0 0 40px;
80 | font-weight: 500;
81 | font-size: 1rem;
82 | }
83 |
84 | .login-form {
85 | width: 100%;
86 | margin: 0;
87 | display: grid;
88 | }
89 |
90 | .login-form input.control::placeholder {
91 | color: #868b94;
92 | }
93 |
94 | .login-form > button.control {
95 | cursor: pointer;
96 | width: 100%;
97 | height: 56px;
98 | padding: 0 16px;
99 | background: #f9f9f9;
100 | color: #000000;
101 | border: 0;
102 | font-family: inherit;
103 | font-size: 1rem;
104 | font-weight: 600;
105 | text-align: center;
106 | letter-spacing: 2px;
107 | transition: all 0.375s;
108 | }
109 |
110 | .username {
111 | position: relative;
112 | }
113 |
114 | @keyframes spin {
115 | 100% {
116 | rotate: 1turn;
117 | }
118 | }
119 |
120 | .spinner {
121 | position: absolute;
122 | top: 50%;
123 | right: 16px;
124 | translate: 0 -50%;
125 | width: 24px;
126 | height: 24px;
127 | border-radius: 50%;
128 | border: 3px solid #ccc9e1;
129 | border-top-color: #8f44fd;
130 | opacity: 0;
131 | animation: spin 1s infinite linear;
132 | }
133 |
134 | .spinner.visible {
135 | opacity: 1;
136 | }
137 |
138 | .indicator {
139 | display: flex;
140 | align-items: center;
141 | justify-content: space-between;
142 | }
143 |
144 | #bars {
145 | margin: 8px 0;
146 | flex: 1 1 auto;
147 | display: flex;
148 | align-items: center;
149 | gap: 8px;
150 | height: 6px;
151 | border-radius: 3px;
152 | background: rgba(255, 255, 255, 0.1);
153 | }
154 |
155 | #bars div {
156 | height: 6px;
157 | border-radius: 3px;
158 | transition: 0.4s;
159 | width: 0%;
160 | }
161 |
162 | #bars.weak div {
163 | background: #bc2b38;
164 | width: 33.33%;
165 | }
166 |
167 | #bars.medium div {
168 | background: #d36f30;
169 | width: 66.66%;
170 | }
171 |
172 | #bars.strong div {
173 | background: #1eb965;
174 | width: 100%;
175 | }
176 |
177 | .strength {
178 | text-align: left;
179 | height: 30px;
180 | text-transform: capitalize;
181 | }
182 |
--------------------------------------------------------------------------------
/signup-4/logo.svg:
--------------------------------------------------------------------------------
1 |
41 |
--------------------------------------------------------------------------------
/signup-3/3.svg:
--------------------------------------------------------------------------------
1 |
39 |
--------------------------------------------------------------------------------
/signup-3/2.svg:
--------------------------------------------------------------------------------
1 |
55 |
--------------------------------------------------------------------------------
/signup-3/1.svg:
--------------------------------------------------------------------------------
1 |
45 |
--------------------------------------------------------------------------------