codeflow-typeracer / login.html
ItsJayKee's picture
now make a log in page where the user must put their name, section and grade level. so after taking the test their name section and grade will be added at the leaderboard
bdf6428 verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login - CodeFlow Typing Challenge</title>
<link rel="stylesheet" href="style.css">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
</head>
<body class="bg-gray-900 text-gray-100 min-h-screen">
<custom-header></custom-header>
<main class="container mx-auto px-4 py-8 max-w-md">
<div class="text-center mb-12">
<h1 class="text-4xl font-bold mb-2 text-indigo-400">Enter Your Details</h1>
<p class="text-lg text-gray-400">Your information will appear on the leaderboard</p>
</div>
<div class="bg-gray-800 rounded-xl p-6 shadow-lg">
<form id="login-form" class="space-y-6">
<div>
<label for="name" class="block text-sm font-medium text-gray-300 mb-1">Full Name</label>
<input type="text" id="name" required
class="w-full bg-gray-900 border border-gray-700 rounded-lg p-3 focus:border-indigo-500 focus:outline-none">
</div>
<div>
<label for="grade" class="block text-sm font-medium text-gray-300 mb-1">Grade Level</label>
<select id="grade" required
class="w-full bg-gray-900 border border-gray-700 rounded-lg p-3 focus:border-indigo-500 focus:outline-none">
<option value="">Select Grade</option>
<option value="7">Grade 7</option>
<option value="8">Grade 8</option>
<option value="9">Grade 9</option>
<option value="10">Grade 10</option>
<option value="11">Grade 11</option>
<option value="12">Grade 12</option>
<option value="college">College</option>
</select>
</div>
<div>
<label for="section" class="block text-sm font-medium text-gray-300 mb-1">Section</label>
<input type="text" id="section" required
class="w-full bg-gray-900 border border-gray-700 rounded-lg p-3 focus:border-indigo-500 focus:outline-none">
</div>
<button type="submit"
class="w-full bg-indigo-600 hover:bg-indigo-700 px-6 py-3 rounded-lg text-lg transition">
Start Typing Test
</button>
</form>
</div>
</main>
<custom-footer></custom-footer>
<script src="components/header.js"></script>
<script src="components/footer.js"></script>
<script>
feather.replace();
document.getElementById('login-form').addEventListener('submit', function(e) {
e.preventDefault();
const name = document.getElementById('name').value.trim();
const grade = document.getElementById('grade').value;
const section = document.getElementById('section').value.trim();
if (!name || !grade || !section) {
alert('Please fill in all fields');
return;
}
// Store user info in localStorage
localStorage.setItem('userInfo', JSON.stringify({
name,
grade,
section
}));
// Redirect to test page
window.location.href = '/';
});
</script>
</body>
</html>