create-template-html-css 1.6.4 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,83 @@
1
+ // Login Form Handler
2
+ const loginForm = document.getElementById('loginForm');
3
+
4
+ if (loginForm) {
5
+ loginForm.addEventListener('submit', function(e) {
6
+ e.preventDefault();
7
+
8
+ const email = document.getElementById('email').value;
9
+ const password = document.getElementById('password').value;
10
+ const remember = document.getElementById('remember').checked;
11
+
12
+ // Validate inputs
13
+ if (!email || !password) {
14
+ alert('Please fill in all required fields');
15
+ return;
16
+ }
17
+
18
+ // Email validation
19
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
20
+ if (!emailRegex.test(email)) {
21
+ alert('Please enter a valid email address');
22
+ return;
23
+ }
24
+
25
+ // Password validation (minimum 6 characters)
26
+ if (password.length < 6) {
27
+ alert('Password must be at least 6 characters long');
28
+ return;
29
+ }
30
+
31
+ console.log('Login attempt:', {
32
+ email: email,
33
+ password: '***',
34
+ remember: remember
35
+ });
36
+
37
+ // Here you would send the login request to your backend
38
+ alert('Login successful! (This is a demo)');
39
+
40
+ // Reset form
41
+ loginForm.reset();
42
+ });
43
+ }
44
+
45
+ // Forgot password link
46
+ const forgotLink = document.querySelector('.forgot-link');
47
+ if (forgotLink) {
48
+ forgotLink.addEventListener('click', function(e) {
49
+ e.preventDefault();
50
+ const email = document.getElementById('email').value;
51
+ if (email) {
52
+ alert(`Password reset link will be sent to: ${email}`);
53
+ } else {
54
+ alert('Please enter your email address first');
55
+ }
56
+ });
57
+ }
58
+
59
+ // Social button handlers
60
+ const socialButtons = document.querySelectorAll('.social-btn');
61
+ socialButtons.forEach(button => {
62
+ button.addEventListener('click', function(e) {
63
+ e.preventDefault();
64
+ const provider = this.classList.contains('google-btn') ? 'Google' : 'GitHub';
65
+ console.log(`Login with ${provider}`);
66
+ alert(`${provider} login initiated (This is a demo)`);
67
+ });
68
+ });
69
+
70
+ // Password visibility toggle (optional enhancement)
71
+ const passwordInput = document.getElementById('password');
72
+ if (passwordInput) {
73
+ const togglePassword = function() {
74
+ if (passwordInput.type === 'password') {
75
+ passwordInput.type = 'text';
76
+ } else {
77
+ passwordInput.type = 'password';
78
+ }
79
+ };
80
+
81
+ // You can bind this to a button if needed
82
+ // passwordToggleBtn.addEventListener('click', togglePassword);
83
+ }
@@ -0,0 +1,232 @@
1
+ * {
2
+ margin: 0;
3
+ padding: 0;
4
+ box-sizing: border-box;
5
+ }
6
+
7
+ body {
8
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
9
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
10
+ min-height: 100vh;
11
+ display: flex;
12
+ justify-content: center;
13
+ align-items: center;
14
+ padding: 20px;
15
+ }
16
+
17
+ .container {
18
+ width: 100%;
19
+ max-width: 450px;
20
+ }
21
+
22
+ .login-card {
23
+ background: white;
24
+ padding: 50px 40px;
25
+ border-radius: 20px;
26
+ box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
27
+ animation: slideUp 0.5s ease-out;
28
+ }
29
+
30
+ @keyframes slideUp {
31
+ from {
32
+ opacity: 0;
33
+ transform: translateY(30px);
34
+ }
35
+ to {
36
+ opacity: 1;
37
+ transform: translateY(0);
38
+ }
39
+ }
40
+
41
+ .login-title {
42
+ color: #333;
43
+ font-size: 2rem;
44
+ margin-bottom: 10px;
45
+ text-align: center;
46
+ }
47
+
48
+ .login-subtitle {
49
+ color: #666;
50
+ text-align: center;
51
+ margin-bottom: 35px;
52
+ font-size: 0.95rem;
53
+ }
54
+
55
+ .login-form {
56
+ margin-bottom: 30px;
57
+ }
58
+
59
+ .form-group {
60
+ margin-bottom: 25px;
61
+ }
62
+
63
+ .form-group label {
64
+ display: block;
65
+ color: #333;
66
+ font-weight: 600;
67
+ margin-bottom: 8px;
68
+ font-size: 0.95rem;
69
+ }
70
+
71
+ .form-group input[type="email"],
72
+ .form-group input[type="password"] {
73
+ width: 100%;
74
+ padding: 12px 15px;
75
+ border: 2px solid #e0e0e0;
76
+ border-radius: 10px;
77
+ font-size: 0.95rem;
78
+ transition: all 0.3s ease;
79
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
80
+ }
81
+
82
+ .form-group input[type="email"]:focus,
83
+ .form-group input[type="password"]:focus {
84
+ outline: none;
85
+ border-color: #667eea;
86
+ box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
87
+ }
88
+
89
+ .remember-forgot {
90
+ display: flex;
91
+ justify-content: space-between;
92
+ align-items: center;
93
+ margin-bottom: 30px;
94
+ }
95
+
96
+ .checkbox-wrapper {
97
+ display: flex;
98
+ align-items: center;
99
+ gap: 8px;
100
+ }
101
+
102
+ .checkbox-wrapper input[type="checkbox"] {
103
+ width: 18px;
104
+ height: 18px;
105
+ cursor: pointer;
106
+ accent-color: #667eea;
107
+ }
108
+
109
+ .checkbox-wrapper label {
110
+ margin: 0;
111
+ font-weight: 500;
112
+ cursor: pointer;
113
+ color: #666;
114
+ }
115
+
116
+ .forgot-link {
117
+ color: #667eea;
118
+ text-decoration: none;
119
+ font-weight: 600;
120
+ transition: color 0.3s ease;
121
+ }
122
+
123
+ .forgot-link:hover {
124
+ color: #764ba2;
125
+ }
126
+
127
+ .login-btn {
128
+ width: 100%;
129
+ padding: 14px;
130
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
131
+ color: white;
132
+ border: none;
133
+ border-radius: 10px;
134
+ font-size: 1rem;
135
+ font-weight: 600;
136
+ cursor: pointer;
137
+ transition: all 0.3s ease;
138
+ box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
139
+ }
140
+
141
+ .login-btn:hover {
142
+ transform: translateY(-2px);
143
+ box-shadow: 0 15px 35px rgba(102, 126, 234, 0.5);
144
+ }
145
+
146
+ .login-btn:active {
147
+ transform: translateY(0);
148
+ }
149
+
150
+ .form-divider {
151
+ display: flex;
152
+ align-items: center;
153
+ margin: 30px 0;
154
+ color: #999;
155
+ font-size: 0.85rem;
156
+ }
157
+
158
+ .form-divider::before,
159
+ .form-divider::after {
160
+ content: '';
161
+ flex: 1;
162
+ height: 1px;
163
+ background: #e0e0e0;
164
+ }
165
+
166
+ .form-divider span {
167
+ padding: 0 15px;
168
+ }
169
+
170
+ .social-buttons {
171
+ display: grid;
172
+ grid-template-columns: 1fr 1fr;
173
+ gap: 15px;
174
+ margin-bottom: 25px;
175
+ }
176
+
177
+ .social-btn {
178
+ padding: 12px;
179
+ border: 2px solid #e0e0e0;
180
+ background: white;
181
+ border-radius: 10px;
182
+ font-weight: 600;
183
+ cursor: pointer;
184
+ transition: all 0.3s ease;
185
+ display: flex;
186
+ align-items: center;
187
+ justify-content: center;
188
+ gap: 8px;
189
+ }
190
+
191
+ .social-btn:hover {
192
+ border-color: #667eea;
193
+ background: #f9f9f9;
194
+ }
195
+
196
+ .social-btn span {
197
+ color: #333;
198
+ font-size: 0.9rem;
199
+ }
200
+
201
+ .signup-link {
202
+ text-align: center;
203
+ color: #666;
204
+ font-size: 0.95rem;
205
+ }
206
+
207
+ .signup-link a {
208
+ color: #667eea;
209
+ text-decoration: none;
210
+ font-weight: 600;
211
+ transition: color 0.3s ease;
212
+ }
213
+
214
+ .signup-link a:hover {
215
+ color: #764ba2;
216
+ }
217
+
218
+ @media (max-width: 480px) {
219
+ .login-card {
220
+ padding: 30px 25px;
221
+ }
222
+
223
+ .login-title {
224
+ font-size: 1.5rem;
225
+ }
226
+
227
+ .remember-forgot {
228
+ flex-direction: column;
229
+ align-items: flex-start;
230
+ gap: 15px;
231
+ }
232
+ }
@@ -35,10 +35,61 @@
35
35
  <li class="nav-item">
36
36
  <a href="#contact" class="nav-link">Contact</a>
37
37
  </li>
38
+ <li class="nav-item">
39
+ <button class="nav-link login-btn" id="loginModalBtn">Login</button>
40
+ </li>
38
41
  </ul>
39
42
  </div>
40
43
  </nav>
41
44
 
45
+ <!-- Login Modal -->
46
+ <div class="modal" id="loginModal">
47
+ <div class="modal-overlay" id="modalOverlay"></div>
48
+ <div class="modal-content">
49
+ <button class="modal-close" id="closeLoginModal">&times;</button>
50
+
51
+ <div class="login-card">
52
+ <h1 class="login-title">Welcome Back</h1>
53
+ <p class="login-subtitle">Login to your account</p>
54
+
55
+ <form class="login-form" id="loginForm">
56
+ <div class="form-group">
57
+ <label for="email">Email Address</label>
58
+ <input type="email" id="email" name="email" placeholder="you@example.com" required>
59
+ </div>
60
+
61
+ <div class="form-group">
62
+ <label for="password">Password</label>
63
+ <input type="password" id="password" name="password" placeholder="Enter your password" required>
64
+ </div>
65
+
66
+ <div class="form-group remember-forgot">
67
+ <div class="checkbox-wrapper">
68
+ <input type="checkbox" id="remember" name="remember">
69
+ <label for="remember">Remember me</label>
70
+ </div>
71
+ <a href="#" class="forgot-link">Forgot Password?</a>
72
+ </div>
73
+
74
+ <button type="submit" class="login-btn">Login</button>
75
+ </form>
76
+
77
+ <div class="form-divider">
78
+ <span>Or continue with</span>
79
+ </div>
80
+
81
+ <div class="social-buttons">
82
+ <button class="social-btn google-btn">
83
+ <span>Google</span>
84
+ </button>
85
+ <button class="social-btn github-btn">
86
+ <span>GitHub</span>
87
+ </button>
88
+ </div>
89
+ </div>
90
+ </div>
91
+ </div>
92
+
42
93
  <main class="main-content">
43
94
  <section id="home" class="section">
44
95
  <h1>Home</h1>
@@ -1,19 +1,125 @@
1
1
  // Mobile menu toggle
2
2
  const navToggle = document.getElementById('navToggle');
3
3
  const navMenu = document.getElementById('navMenu');
4
+ const loginModalBtn = document.getElementById('loginModalBtn');
5
+ const loginModal = document.getElementById('loginModal');
6
+ const closeLoginModal = document.getElementById('closeLoginModal');
7
+ const modalOverlay = document.getElementById('modalOverlay');
4
8
 
5
9
  navToggle.addEventListener('click', function() {
6
10
  navMenu.classList.toggle('active');
7
11
  navToggle.classList.toggle('active');
8
12
  });
9
13
 
14
+ // Login Modal Functions
15
+ function openLoginModal() {
16
+ loginModal.classList.add('active');
17
+ document.body.style.overflow = 'hidden';
18
+ }
19
+
20
+ function closeModal() {
21
+ loginModal.classList.remove('active');
22
+ document.body.style.overflow = 'auto';
23
+ }
24
+
25
+ // Login modal button
26
+ if (loginModalBtn) {
27
+ loginModalBtn.addEventListener('click', openLoginModal);
28
+ }
29
+
30
+ // Close button
31
+ if (closeLoginModal) {
32
+ closeLoginModal.addEventListener('click', closeModal);
33
+ }
34
+
35
+ // Close on overlay click
36
+ if (modalOverlay) {
37
+ modalOverlay.addEventListener('click', closeModal);
38
+ }
39
+
40
+ // Close on ESC key
41
+ document.addEventListener('keydown', function(e) {
42
+ if (e.key === 'Escape' && loginModal.classList.contains('active')) {
43
+ closeModal();
44
+ }
45
+ });
46
+
47
+ // Login form handler
48
+ const loginForm = document.getElementById('loginForm');
49
+ if (loginForm) {
50
+ loginForm.addEventListener('submit', function(e) {
51
+ e.preventDefault();
52
+
53
+ const email = document.getElementById('email').value;
54
+ const password = document.getElementById('password').value;
55
+ const remember = document.getElementById('remember').checked;
56
+
57
+ // Validate inputs
58
+ if (!email || !password) {
59
+ alert('Please fill in all required fields');
60
+ return;
61
+ }
62
+
63
+ // Email validation
64
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
65
+ if (!emailRegex.test(email)) {
66
+ alert('Please enter a valid email address');
67
+ return;
68
+ }
69
+
70
+ // Password validation (minimum 6 characters)
71
+ if (password.length < 6) {
72
+ alert('Password must be at least 6 characters long');
73
+ return;
74
+ }
75
+
76
+ console.log('Login attempt:', {
77
+ email: email,
78
+ password: '***',
79
+ remember: remember
80
+ });
81
+
82
+ // Here you would send the login request to your backend
83
+ alert('Login successful! (This is a demo)');
84
+
85
+ // Reset form and close modal
86
+ loginForm.reset();
87
+ closeModal();
88
+ });
89
+ }
90
+
91
+ // Forgot password link
92
+ const forgotLink = document.querySelector('.forgot-link');
93
+ if (forgotLink) {
94
+ forgotLink.addEventListener('click', function(e) {
95
+ e.preventDefault();
96
+ const email = document.getElementById('email').value;
97
+ if (email) {
98
+ alert(`Password reset link will be sent to: ${email}`);
99
+ } else {
100
+ alert('Please enter your email address first');
101
+ }
102
+ });
103
+ }
104
+
105
+ // Social button handlers
106
+ const socialButtons = document.querySelectorAll('.social-btn');
107
+ socialButtons.forEach(button => {
108
+ button.addEventListener('click', function(e) {
109
+ e.preventDefault();
110
+ const provider = this.classList.contains('google-btn') ? 'Google' : 'GitHub';
111
+ console.log(`Login with ${provider}`);
112
+ alert(`${provider} login initiated (This is a demo)`);
113
+ });
114
+ });
115
+
10
116
  // Smooth scrolling for navigation links
11
- document.querySelectorAll('.nav-link').forEach(link => {
117
+ document.querySelectorAll('.nav-link:not(.login-btn)').forEach(link => {
12
118
  link.addEventListener('click', function(e) {
13
119
  e.preventDefault();
14
120
 
15
121
  // Remove active class from all links
16
- document.querySelectorAll('.nav-link').forEach(l => l.classList.remove('active'));
122
+ document.querySelectorAll('.nav-link:not(.login-btn)').forEach(l => l.classList.remove('active'));
17
123
 
18
124
  // Add active class to clicked link
19
125
  this.classList.add('active');
@@ -39,7 +145,7 @@ document.querySelectorAll('.nav-link').forEach(link => {
39
145
  // Highlight active section on scroll
40
146
  window.addEventListener('scroll', function() {
41
147
  const sections = document.querySelectorAll('.section');
42
- const navLinks = document.querySelectorAll('.nav-link');
148
+ const navLinks = document.querySelectorAll('.nav-link:not(.login-btn)');
43
149
 
44
150
  let current = '';
45
151