recovery-code.tsx
"use client"
import { useId } from "react"
import Link from "next/link"
import {
Avatar,
AvatarFallback,
AvatarImage,
} from "@/components/ui/avatar"
import { Button } from "@/components/ui/button"
import { Field, FieldGroup, FieldLabel } from "@/components/ui/field"
import { Input } from "@/components/ui/input"
import { FancyButton } from "@/components/ui/fancy-button"
import { Icons } from "@/components/ui/icons"
export function RecoveryCode() {
const id = useId()
return (
<main
aria-label="Recovery code"
className="w-full max-w-xl rounded-4xl text-foreground motion-reduce:**:animate-none motion-reduce:**:transition-none lg:max-w-4xl lg:bg-muted lg:p-1"
>
<section className="grid grid-cols-1 lg:grid-cols-2">
<div className="flex flex-col gap-6 rounded-3xl bg-card p-6 shadow-elevated-lg">
<div className="flex flex-col items-center gap-4">
<FancyButton
size="icon-lg"
aria-label="Home"
role="link"
className="size-14 rounded-xl"
render={<Link href="/" />}
>
<Icons.Logo aria-hidden="true" className="size-10" />
</FancyButton>
<div className="text-center">
<h1 className="text-xl font-semibold tracking-tight text-balance">
Recovery code
</h1>
<p className="text-base text-muted-foreground">
Enter your backup code to verify your identity.
</p>
</div>
</div>
<FieldGroup className="gap-3">
<Field className="gap-1">
<FieldLabel htmlFor={`${id}-recovery-code`} className="gap-0">
Recovery code <span className="text-primary">*</span>
</FieldLabel>
<Input
id={`${id}-recovery-code`}
type="text"
placeholder="1234-5678-9012-3456"
className="h-10 bg-transparent"
/>
</Field>
<FancyButton type="button" size="lg" className="w-full">
Verify code
</FancyButton>
</FieldGroup>
<p className="text-center text-sm text-muted-foreground">
<Button
variant="link"
className="h-auto p-0"
nativeButton={false}
role="link"
render={<Link href="/two-factor" />}
>
Try another method
</Button>
{" · "}
<Button
variant="link"
className="h-auto p-0"
nativeButton={false}
role="link"
render={<Link href="/sign-in" />}
>
Back to login
</Button>
</p>
</div>
<div className="flex max-lg:hidden lg:flex-col lg:justify-end lg:p-12">
<div className="mt-auto flex flex-col gap-6">
<p className="text-lg leading-relaxed">
“Had to use a recovery code while traveling. The process was{" "}
<span className="font-medium text-primary">straightforward</span>{" "}
— back in my account in under a minute.”
</p>
<div className="flex items-center gap-3">
<Avatar className="size-10">
<AvatarImage
src="https://github.com/pacocoursey.png"
alt="Paco Coursey"
/>
<AvatarFallback>P</AvatarFallback>
</Avatar>
<div>
<p className="text-sm font-semibold">Paco Coursey</p>
<p className="text-xs text-muted-foreground">Engineer</p>
</div>
</div>
</div>
</div>
</section>
</main>
)
}




























