This commit is contained in:
Kiran Surendran Pankan 2025-04-07 09:56:47 +05:30
parent 1965fed75e
commit 6e44a34438
2 changed files with 229 additions and 0 deletions

View File

@ -13,6 +13,8 @@
text-rendering: optimizeLegibility; text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
box-sizing: border-box;
} }
// Default dark theme // Default dark theme

227
src/views/Login.vue Normal file
View File

@ -0,0 +1,227 @@
<script setup>
import { ref, computed } from 'vue';
import { useRouter } from 'vue-router';
// Form state
const username = ref('');
const password = ref('');
// Router for navigation
const router = useRouter();
// Computed property to check if form is valid
const isFormValid = computed(() => {
return username.value.trim() !== '' && password.value.trim() !== '';
});
// Login function
const handleLogin = () => {
if (!isFormValid.value) return;
// Store authentication state in localStorage
localStorage.setItem('isLoggedIn', 'true');
// Navigate to dashboard
router.push({ name: 'dashboard' });
};
// Forgot password function
const handleForgotPassword = () => {
// This would typically open a modal or navigate to a forgot password page
alert('Forgot password functionality will be implemented in a future update.');
};
</script>
<template>
<div class="login-container">
<div class="login-modal">
<div class="login-header">
<h1><span class="logo-icon">👔</span> jJobs</h1>
<p>Sign in to your account</p>
</div>
<form @submit.prevent="handleLogin" class="login-form">
<div class="form-group">
<label for="username">Username</label>
<input
type="text"
id="username"
v-model="username"
placeholder="Enter your username"
autocomplete="username"
/>
</div>
<div class="form-group">
<label for="password">Password</label>
<input
type="password"
id="password"
v-model="password"
placeholder="Enter your password"
autocomplete="current-password"
/>
</div>
<div class="form-actions">
<button
type="submit"
class="login-button"
:disabled="!isFormValid"
:class="{ 'disabled': !isFormValid }"
>
Login
</button>
<button
type="button"
class="forgot-password-button"
@click="handleForgotPassword"
>
Forgot Password?
</button>
</div>
</form>
</div>
</div>
</template>
<style lang="scss" scoped>
.login-container {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
width: 100%;
background-color: var(--bg-color);
position: fixed;
top: 0;
left: 0;
z-index: 100;
}
.login-modal {
width: 100%;
max-width: 420px;
background-color: var(--card-bg);
border-radius: 12px;
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
padding: 2.5rem;
transition: all 0.3s ease;
}
.login-header {
text-align: center;
margin-bottom: 2rem;
h1 {
font-size: 2rem;
margin-bottom: 0.5rem;
color: var(--text-color);
display: flex;
align-items: center;
justify-content: center;
.logo-icon {
margin-right: 0.5rem;
}
}
p {
color: var(--text-color-secondary);
font-size: 1rem;
margin: 0;
}
}
.login-form {
.form-group {
margin-bottom: 1.5rem;
label {
display: block;
margin-bottom: 0.5rem;
font-size: 0.9rem;
color: var(--text-color);
font-weight: 500;
}
input {
width: 100%;
padding: 0.75rem 1rem;
border: 1px solid var(--card-border);
border-radius: 8px;
background-color: var(--card-bg-secondary);
color: var(--text-color);
font-size: 1rem;
transition: all 0.3s ease;
&:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}
&::placeholder {
color: var(--text-color-tertiary);
}
}
}
.form-actions {
display: flex;
flex-direction: column;
gap: 1rem;
margin-top: 2rem;
.login-button {
width: 100%;
padding: 0.75rem;
background-color: var(--primary-color);
color: white;
border: none;
border-radius: 8px;
font-size: 1rem;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
&:hover:not(.disabled) {
background-color: var(--primary-hover-color);
}
&.disabled {
opacity: 0.6;
cursor: not-allowed;
}
}
.forgot-password-button {
background: none;
border: none;
color: var(--primary-color);
font-size: 0.9rem;
cursor: pointer;
padding: 0.5rem;
text-align: center;
&:hover {
text-decoration: underline;
}
}
}
}
// Responsive adjustments
@media (max-width: 480px) {
.login-modal {
max-width: 100%;
border-radius: 0;
padding: 2rem 1.5rem;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
}
}
</style>