From db882f48c4038afb1d1491091098ad9ac060320b Mon Sep 17 00:00:00 2001 From: dwindown Date: Fri, 2 Jan 2026 10:42:01 +0700 Subject: [PATCH] Add back to home button on auth page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added a "Kembali ke Beranda" (Back to Home) button on the login/signup page to allow users to navigate back to the home page without needing to authenticate. Changes: - Imported Link and ArrowLeft icon from lucide-react - Added button above the auth card that links to "/" - Wrapped content in a space-y-4 container for proper spacing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- src/pages/Auth.tsx | 121 ++++++++++++++++++++++++--------------------- 1 file changed, 66 insertions(+), 55 deletions(-) diff --git a/src/pages/Auth.tsx b/src/pages/Auth.tsx index b39e5fc..fbe6598 100644 --- a/src/pages/Auth.tsx +++ b/src/pages/Auth.tsx @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react'; -import { useNavigate } from 'react-router-dom'; +import { useNavigate, Link } from 'react-router-dom'; import { useAuth } from '@/hooks/useAuth'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; @@ -7,6 +7,7 @@ import { Label } from '@/components/ui/label'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import { toast } from '@/hooks/use-toast'; import { z } from 'zod'; +import { ArrowLeft } from 'lucide-react'; const emailSchema = z.string().email('Invalid email address'); const passwordSchema = z.string().min(6, 'Password must be at least 6 characters'); @@ -71,66 +72,76 @@ export default function Auth() { return (
- - - {isLogin ? 'Login' : 'Sign Up'} - - {isLogin ? 'Enter your credentials to access your account' : 'Create a new account to get started'} - - - -
- {!isLogin && ( +
+ {/* Back to Home Button */} + + + + + + + {isLogin ? 'Login' : 'Sign Up'} + + {isLogin ? 'Enter your credentials to access your account' : 'Create a new account to get started'} + + + + + {!isLogin && ( +
+ + setName(e.target.value)} + placeholder="Your name" + className="border-2" + /> +
+ )}
- + setName(e.target.value)} - placeholder="Your name" + id="email" + type="email" + value={email} + onChange={(e) => setEmail(e.target.value)} + placeholder="your@email.com" className="border-2" />
- )} -
- - setEmail(e.target.value)} - placeholder="your@email.com" - className="border-2" - /> +
+ + setPassword(e.target.value)} + placeholder="••••••••" + className="border-2" + /> +
+ + + +
+
-
- - setPassword(e.target.value)} - placeholder="••••••••" - className="border-2" - /> -
- - - -
- -
- - + + +
); }