feat: Enhance login form with styling and error handling

This commit is contained in:
Kerby Martino authored and Kerby Martino (aider) committed 2025-05-03 15:39:03 +08:00
1 parent 6a93eae05c
commit f17df7315f
1 file changed
+67 -65
+67 -65
View File
@@ -1,71 +1,73 @@
<div> <!-- Removed max-w-md mx-auto --> <div class="min-h-screen flex items-center justify-center overflow-hidden">
<div class="w-full max-w-md mx-auto bg-bg-light rounded-lg p-6">
<!-- Tabs Navigation --> <!-- Tabs Navigation -->
<div class="mb-4 border-b border-gray-200"> <div class="mb-4 border-b border-gray-200">
<nav class="-mb-px flex space-x-8" aria-label="Tabs"> <nav class="-mb-px flex space-x-8" aria-label="Tabs">
<a href="#tab-login" class="group whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm <a href="#tab-login" class="whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm
border-primary text-primary [&:not(:target):not(:has(~:target))]:border-primary [&:not(:target):not(:has(~:target))]:text-primary border-primary text-primary [&:not(:target):not(:has(~:target))]:border-primary [&:not(:target):not(:has(~:target))]:text-primary
[&:target]:border-primary [&:target]:text-primary [&:target]:border-primary [&:target]:text-primary
[&:not(:target)]:border-transparent [&:not(:target)]:text-gray-500 [&:not(:target)]:hover:text-gray-700 [&:not(:target)]:hover:border-gray-300"> [&:not(:target)]:border-transparent [&:not(:target)]:text-gray-500 [&:not(:target)]:hover:text-gray-700 [&:not(:target)]:hover:border-gray-300">
Login Login
</a> </a>
<a href="#tab-create-account" class="whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm <a href="#tab-create-account" class="whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm
[&:target]:border-primary [&:target]:text-primary [&:target]:border-primary [&:target]:text-primary
[&:not(:target)]:border-transparent [&:not(:target)]:text-gray-500 [&:not(:target)]:hover:text-gray-700 [&:not(:target)]:hover:border-gray-300"> [&:not(:target)]:border-transparent [&:not(:target)]:text-gray-500 [&:not(:target)]:hover:text-gray-700 [&:not(:target)]:hover:border-gray-300">
Create Account Create Account
</a> </a>
</nav> </nav>
</div>
<!-- Tab Content Panes -->
<div>
<!-- Login Pane -->
<div id="tab-login" class="block [&:not(:target)]:hidden [&:not(:target):not(:has(~:target))]:block">
<form class="space-y-6"> <!-- Removed mb-10 -->
<!-- Removed h2 heading -->
<div>
<label for="username" class="block text-sm font-medium text-text-muted mb-1">Username</label>
<input type="text" id="username" name="username" placeholder="Enter your username" class="w-full text-primary text-base px-3 py-2 bg-transparent border-b-2 border-gray-300 focus:outline-none focus:border-primary transition duration-150 ease-in-out" required>
</div>
<div>
<label for="password" class="block text-sm font-medium text-text-muted mb-1">Password</label> <!-- Adjusted label style -->
<input type="password" id="password" name="password" placeholder="Enter your password" class="w-full text-primary text-base px-3 py-2 bg-transparent border-b-2 border-gray-300 focus:outline-none focus:border-primary transition duration-150 ease-in-out" required> <!-- Line input style -->
</div>
<!-- Placeholder for error message -->
<p class="text-sm text-red-500 text-center">Bad Login</p> <!-- Centered error message -->
<div class="pt-2"> <!-- Added padding top -->
<button type="submit" class="w-full px-6 py-3 bg-primary text-white text-base font-medium rounded-md shadow-sm hover:bg-primary-dark focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary transition duration-150 ease-in-out font-monda">Login</button> <!-- Larger, full-width button -->
</div>
<div class="text-center mt-4"> <!-- Centered link -->
<a href="#" class="text-sm text-primary hover:underline">Forgot your password?</a>
</div>
</form>
</div> </div>
<!-- Create Account Pane --> <!-- Tab Content Panes -->
<div id="tab-create-account" class="hidden [&:target]:block">
<form class="space-y-6">
<!-- Removed h2 heading -->
<div>
<label for="new_username" class="block text-sm font-medium text-text-muted mb-1">Username</label>
<input type="text" id="new_username" name="new_username" placeholder="Choose a username" class="w-full text-primary text-base px-3 py-2 bg-transparent border-b-2 border-gray-300 focus:outline-none focus:border-primary transition duration-150 ease-in-out" required>
</div>
<div> <div>
<label for="new_password" class="block text-sm font-medium text-text-muted mb-1">Password</label> <!-- Adjusted label style --> <!-- Login Pane -->
<input type="password" id="new_password" name="new_password" placeholder="Create a password" class="w-full text-primary text-base px-3 py-2 bg-transparent border-b-2 border-gray-300 focus:outline-none focus:border-primary transition duration-150 ease-in-out" required> <div id="tab-login" class="block [&:not(:target)]:hidden [&:not(:target):not(:has(~:target))]:block">
<p class="mt-1 text-xs text-text-muted">Must be at least 8 characters long.</p> <!-- Info text --> <form class="space-y-6">
</div> <div>
<div> <label for="username" class="block text-sm font-medium text-text-muted mb-1">Username</label>
<label for="confirm_password" class="block text-sm font-medium text-text-muted mb-1">Confirm Password</label> <!-- Adjusted label style --> <input type="text" id="username" name="username" placeholder="Enter your username" class="w-full text-primary text-base px-3 py-2 bg-transparent border-b-2 border-gray-300 focus:outline-none focus:border-primary transition duration-150 ease-in-out placeholder:text-xs" required>
<input type="password" id="confirm_password" name="confirm_password" placeholder="Confirm your password" class="w-full text-primary text-base px-3 py-2 bg-transparent border-b-2 border-gray-300 focus:outline-none focus:border-primary transition duration-150 ease-in-out" required> <!-- Line input style --> </div>
</div> <div>
<!-- Placeholder for error message --> <label for="password" class="block text-sm font-medium text-text-muted mb-1">Password</label>
<p class="text-sm text-red-500 text-center">Passwords do not match</p> <!-- Centered error message --> <input type="password" id="password" name="password" placeholder="Enter your password" class="w-full text-primary text-base px-3 py-2 bg-transparent border-b-2 border-gray-300 focus:outline-none focus:border-primary transition duration-150 ease-in-out placeholder:text-xs" required>
<div class="pt-2"> <!-- Added padding top --> </div>
<button type="submit" class="w-full px-6 py-3 bg-primary text-white text-base font-medium rounded-md shadow-sm hover:bg-primary-dark focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary transition duration-150 ease-in-out font-monda">Create Account</button> <!-- Larger, full-width button --> <!-- Error message with improved presentation -->
</div> <div class="bg-red-50 border border-red-200 rounded-md p-3 hidden">
</form> <p class="text-sm text-red-500 text-center">Bad Login</p>
</div>
<div class="pt-2">
<button type="submit" class="w-full px-6 py-3 bg-primary text-white text-base font-medium rounded-md hover:bg-primary-dark focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary transition duration-150 ease-in-out font-monda font-action">Login</button>
</div>
<div class="text-center mt-4">
<a href="#" class="text-sm text-primary hover:underline">Forgot your password?</a>
</div>
</form>
</div>
<!-- Create Account Pane -->
<div id="tab-create-account" class="hidden [&:target]:block">
<form class="space-y-6">
<div>
<label for="new_username" class="block text-sm font-medium text-text-muted mb-1">Username</label>
<input type="text" id="new_username" name="new_username" placeholder="Choose a username" class="w-full text-primary text-base px-3 py-2 bg-transparent border-b-2 border-gray-300 focus:outline-none focus:border-primary transition duration-150 ease-in-out placeholder:text-xs" required>
</div>
<div>
<label for="new_password" class="block text-sm font-medium text-text-muted mb-1">Password</label>
<input type="password" id="new_password" name="new_password" placeholder="Create a password" class="w-full text-primary text-base px-3 py-2 bg-transparent border-b-2 border-gray-300 focus:outline-none focus:border-primary transition duration-150 ease-in-out placeholder:text-xs" required>
<p class="mt-1 text-xs text-text-muted">Must be at least 8 characters long.</p>
</div>
<div>
<label for="confirm_password" class="block text-sm font-medium text-text-muted mb-1">Confirm Password</label>
<input type="password" id="confirm_password" name="confirm_password" placeholder="Confirm your password" class="w-full text-primary text-base px-3 py-2 bg-transparent border-b-2 border-gray-300 focus:outline-none focus:border-primary transition duration-150 ease-in-out placeholder:text-xs" required>
</div>
<!-- Error message with improved presentation -->
<div class="bg-red-50 border border-red-200 rounded-md p-3 hidden">
<p class="text-sm text-red-500 text-center">Passwords do not match</p>
</div>
<div class="pt-2">
<button type="submit" class="w-full px-6 py-3 bg-primary text-white text-base font-medium rounded-md hover:bg-primary-dark focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary transition duration-150 ease-in-out font-monda font-action">Create Account</button>
</div>
</form>
</div>
</div> </div>
</div> </div>
</div> </div>