Skip to content

Commit

Permalink
improvements and fixes: enhance authentication validation, update nav…
Browse files Browse the repository at this point in the history
…igation styles, and refine error message component
  • Loading branch information
LeonardoMeireles55 committed Feb 6, 2025
1 parent bda19e5 commit 8c4111d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
8 changes: 5 additions & 3 deletions src/components/authentication/hooks/useAuthentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ export const useAuth = (isLogin: boolean) => {
if (!formData.email || !emailRegex.test(formData.email)) {
errors.push({ field: 'email', message: 'Invalid email address' });
}
if (formData.password !== formData.confirmPassword) {
if (!formData.confirmPassword) {
errors.push({ field: 'confirmPassword', message: 'Confirm Password is required' });
} else if (formData.password !== formData.confirmPassword) {
errors.push({
field: 'confirmPassword',
message: 'Passwords do not match',
Expand All @@ -42,10 +44,10 @@ export const useAuth = (isLogin: boolean) => {

if (!formData.password) {
errors.push({ field: 'password', message: 'Password is required' });
} else if (formData.password.length < 6) {
} else if (formData.password.length < 4 || !/[!@#$%^&*]/.test(formData.password)) {
errors.push({
field: 'password',
message: 'Password must be at least 6 characters and one special character',
message: 'Password must be at least 4 characters and one special character',
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const NavLinksComponent: React.FC<NavLinksComponentProps> = ({ jsonData, fileNam
key={link.url}
href={link.url}
onClick={link.onClick}
className='group relative px-3 py-2 text-sm font-medium text-textPrimary transition-all duration-300 ease-in-out xl:text-base'
className='group relative text-xs xl:text-sm px-3 py-2 font-medium text-textPrimary transition-all duration-300 ease-in-out '
>
{link.text}
<span className='absolute bottom-0 left-1/2 h-0.5 w-0 bg-primary transition-all duration-300 ease-in-out group-hover:w-full group-hover:left-0' />
Expand Down
4 changes: 2 additions & 2 deletions src/components/shared/navigation-bar/components/NavLogo.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const NavLogo = () => (
<div className='flex items-center gap-2 sm:gap-3'>
<div className='flex h-8 w-8 items-center justify-center rounded-xl bg-textSecondary shadow-lg transition-all duration-300 hover:scale-110 hover:bg-primary hover:rotate-3 sm:h-10 sm:w-10'>
<div className='flex h-10 w-10 items-center justify-center rounded-xl bg-textSecondary shadow-lg transition-all duration-300 hover:scale-110 hover:bg-primary hover:rotate-3 sm:h-12 sm:w-12'>
<span className='text-lg font-bold text-surface transition-all duration-300 hover:scale-110 sm:text-xl'>
L
</span>
</div>
<div className='flex flex-col'>
<span className='text-lg font-bold text-textSecondary transition-all duration-300 hover:-translate-y-[2px] hover:text-textPrimary sm:text-xl'>
<span className='text-lg font-bold text-textSecondary transition-all duration-300 hover:-translate-y-[2px] hover:text-textPrimary sm:text-2xl'>
<em>LabGraph</em>
<span className='text-[6px] text-textSecondary md:text-[8px] align-top animate-pulse'>
®
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ErrorMessageProps from './types/errorMessageProps';

const ErrorMessage: React.FC<ErrorMessageProps> = ({ message }) => {
return <div className='bg-danger mb-2 rounded p-3 text-sm text-textPrimary'>{message}</div>;
return <div className='bg-danger mb-2 rounded p-3 text-xs text-errorText'>{message}</div>;
};

export default ErrorMessage;
2 changes: 2 additions & 0 deletions src/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
--color-secondary-hover: #0366d6; /* Darker hover state */
--color-accent: #ff5722; /* updated accent, now distinct from secondary */
--color-danger: #d32f2f; /* Slightly deeper red */
--color-error-text: #fafafa;
--color-background: #fafafa; /* Lighter background */
--color-surface: #ffffff;
--color-muted: #f1f1f1;
Expand Down Expand Up @@ -64,6 +65,7 @@
--color-secondary-hover: #6e9cf5; /* Darker hover state */
--color-accent: #ff7043; /* updated dark accent to contrast secondary */
--color-danger: #d32f2f;
--color-error-text: #fafafa;
--color-background: #242529; /* Darker background */
--color-surface: #2f3136; /* Elevated surface contrast */
--color-muted: #40444b;
Expand Down
2 changes: 2 additions & 0 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const config: Config = {
secondaryHover: 'var(--color-secondary-hover)',
accent: 'var(--color-accent)',
danger: 'var(--color-danger)',
errorText: 'var(--color-error-text)',
background: 'var(--color-background)',
surface: 'var(--color-surface)',
muted: 'var(--color-muted)',
Expand Down Expand Up @@ -82,6 +83,7 @@ const config: Config = {
secondaryHover: 'var(--color-secondary-hover)',
accent: 'var(--color-accent)',
danger: 'var(--color-danger)',
errorText: 'var(--color-error-text)',
background: 'var(--color-background)',
surface: 'var(--color-surface)',
textPrimary: 'var(--color-text-primary)',
Expand Down

0 comments on commit 8c4111d

Please sign in to comment.