backend / frontend /src /pages /AuthLayout.jsx
muhammadhasnain100's picture
add code
49f22ac
Raw History Blame Contribute Delete
3.11 kB
import { Link } from 'react-router-dom'
import ComsatsLogo from '../components/ComsatsLogo'
function ShieldIcon({ className = '' }) {
return (
<svg className={className} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.75" aria-hidden>
<path
strokeLinecap="round"
strokeLinejoin="round"
d="M9 12.75L11.25 15 15 9.75m-3-7.036A11.959 11.959 0 013.598 6 11.99 11.99 0 003 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285z"
/>
</svg>
)
}
export default function AuthLayout({ title, subtitle, children, brandTo = '/login', variant = 'user' }) {
return (
<div className="flex min-h-dvh w-full flex-col items-center justify-start overflow-x-hidden overflow-y-auto bg-gradient-to-b from-chat-sidebar via-white to-comsats-blue/[0.08] px-4 py-8 pb-[max(1.5rem,env(safe-area-inset-bottom))] pt-[max(1.25rem,env(safe-area-inset-top))] sm:justify-center sm:py-12">
<div className="flex w-full max-w-[440px] flex-col items-center gap-6 sm:gap-8">
<Link
to={brandTo}
className="group flex flex-col items-center gap-3 rounded-2xl text-center no-underline outline-none transition-opacity hover:opacity-95 focus-visible:ring-2 focus-visible:ring-comsats-blue focus-visible:ring-offset-2"
>
<div className="rounded-full bg-white p-1 shadow-[0_8px_30px_-12px_rgba(75,46,131,0.35)] ring-2 ring-white transition-shadow group-hover:shadow-[0_12px_36px_-12px_rgba(75,46,131,0.4)]">
<ComsatsLogo className="h-[4.5rem] w-[4.5rem] sm:h-24 sm:w-24" />
</div>
<span className="text-xl font-bold tracking-tight text-comsats-purple sm:text-2xl">
CUI Connect
{variant === 'admin' ? (
<span className="ml-2 align-middle text-sm font-semibold text-slate-500 sm:text-base">
Admin
</span>
) : null}
</span>
</Link>
<div className="w-full rounded-2xl border border-slate-200/90 bg-white p-6 shadow-[0_12px_48px_-20px_rgba(75,46,131,0.22)] sm:rounded-3xl sm:p-8">
<div className="mb-6 text-center">
<h1 className="text-2xl font-semibold tracking-tight text-slate-900">{title}</h1>
{subtitle ? (
<p className="mt-2 text-[15px] leading-relaxed text-slate-600">{subtitle}</p>
) : null}
</div>
<div className="mb-6 flex flex-col items-center gap-2 rounded-xl bg-gradient-to-r from-slate-50 to-comsats-blue/[0.06] px-3 py-2.5 text-center text-[11px] font-medium leading-snug text-slate-600 ring-1 ring-slate-100 sm:flex-row sm:justify-center sm:text-[12px]">
<ShieldIcon className="h-4 w-4 shrink-0 text-comsats-blue" />
<span>
{variant === 'admin'
? 'Administrator console — restricted access'
: 'Secure campus sign-in — your session is protected'}
</span>
</div>
{children}
</div>
</div>
</div>
)
}