feat: Introduce and integrate a mobile back button component across agent and user profile pages.

This commit is contained in:
pradeepkumar
2026-03-20 02:32:58 +05:30
parent d8e75f4a06
commit 9b6fbeb4fd
4 changed files with 45 additions and 1 deletions

View File

@@ -0,0 +1,36 @@
'use client';
import { useRouter } from 'next/navigation';
interface MobileBackButtonProps {
label?: string;
fallbackHref?: string;
}
export function MobileBackButton({ label, fallbackHref }: MobileBackButtonProps) {
const router = useRouter();
const handleBack = () => {
if (window.history.length > 1) {
router.back();
} else if (fallbackHref) {
router.push(fallbackHref);
} else {
router.push('/');
}
};
return (
<button
onClick={handleBack}
className="lg:hidden flex items-center gap-2 mb-4 hover:opacity-70 transition-opacity cursor-pointer"
>
<svg width="20" height="20" viewBox="0 0 24 24" fill="none">
<path d="M19 12H5M5 12L12 19M5 12L12 5" stroke="#00293D" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
</svg>
{label && (
<span className="font-fractul font-medium text-[14px] text-[#00293D]">{label}</span>
)}
</button>
);
}