new-password.tsx
"use client"
import { useId, useState } 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 {
InputGroup,
InputGroupAddon,
InputGroupButton,
InputGroupInput,
} from "@/components/ui/input-group"
import { FancyButton } from "@/components/ui/fancy-button"
import { EyeIcon, EyeOffIcon, LockIcon, StarIcon } from 'lucide-react'
export function NewPassword() {
const id = useId()
const [showPassword, setShowPassword] = useState(false)
const [showConfirmPassword, setShowConfirmPassword] = useState(false)
return (
<main
aria-label="New password"
className="grid min-h-svh w-full grid-cols-1 text-foreground motion-reduce:**:animate-none motion-reduce:**:transition-none lg:grid-cols-2 lg:p-2"
>
<section className="flex flex-col items-center justify-center">
<div className="flex max-w-sm flex-col items-center gap-4">
<div className="relative flex size-14 items-center justify-center">
<div className="absolute inset-0 scale-125 rounded-full bg-primary/10 mask-b-from-20% mask-b-to-100%" />
<div className="relative z-10 flex size-14 items-center justify-center rounded-full bg-card ring ring-primary/10 ring-inset">
<LockIcon aria-hidden="true" className="size-6 text-primary" />
</div>
</div>
<div className="text-center">
<h1 className="text-xl font-semibold tracking-tight text-balance sm:text-2xl">
Set new password
</h1>
<p className="text-base text-muted-foreground">
Create a new password for your account.
</p>
</div>
</div>
<div className="flex w-full max-w-sm flex-col gap-6">
<FieldGroup className="gap-3">
<Field className="gap-1">
<FieldLabel htmlFor={`${id}-password`}>New password</FieldLabel>
<InputGroup className="h-10 bg-transparent">
<InputGroupInput
id={`${id}-password`}
type={showPassword ? "text" : "password"}
placeholder="••••••••••"
className="h-10 bg-transparent"
/>
<InputGroupAddon align="inline-end">
<InputGroupButton
size="icon-xs"
type="button"
onClick={() => setShowPassword((show) => !show)}
aria-label={
showPassword ? "Hide password" : "Show password"
}
>
{showPassword ? <EyeOffIcon aria-hidden="true" /> : <EyeIcon aria-hidden="true" />}
</InputGroupButton>
</InputGroupAddon>
</InputGroup>
</Field>
<Field className="gap-1">
<FieldLabel htmlFor={`${id}-confirm-password`}>
Confirm password
</FieldLabel>
<InputGroup className="h-10 bg-transparent">
<InputGroupInput
id={`${id}-confirm-password`}
type={showConfirmPassword ? "text" : "password"}
placeholder="••••••••••"
className="h-10 bg-transparent"
/>
<InputGroupAddon align="inline-end">
<InputGroupButton
size="icon-xs"
type="button"
onClick={() => setShowConfirmPassword((show) => !show)}
aria-label={
showConfirmPassword
? "Hide confirmation password"
: "Show confirmation password"
}
>
{showConfirmPassword ? <EyeOffIcon aria-hidden="true" /> : <EyeIcon aria-hidden="true" />}
</InputGroupButton>
</InputGroupAddon>
</InputGroup>
</Field>
<FancyButton type="button" size="lg" className="w-full">
Update password
</FancyButton>
</FieldGroup>
<div className="flex flex-wrap items-center justify-center gap-x-1 gap-y-0.5 text-sm text-muted-foreground">
<span>Changed your mind?</span>
<Button
variant="link"
className="h-auto p-0"
nativeButton={false}
role="link"
render={<Link href="/sign-up" />}
>
Go back
</Button>
</div>
</div>
</section>
<div className="relative flex flex-col justify-end overflow-hidden rounded-4xl bg-muted p-12 max-lg:hidden">
<div className="pointer-events-none absolute inset-0 bg-linear-to-t from-primary/25 via-primary/10 to-transparent" />
<div className="relative flex flex-col gap-6">
<div className="flex gap-0.5">
{[1, 2, 3, 4, 5].map((rating) => (
<StarIcon aria-hidden="true" key={rating} className="size-4 fill-primary text-primary" />
))}
</div>
<p className="text-lg leading-relaxed">
“Security that doesn't get in the way. Updating my
password felt{" "}
<span className="font-medium text-primary">effortless</span>.”
</p>
<div className="flex items-center gap-3">
<Avatar className="size-10">
<AvatarImage
src="https://github.com/evilrabbit.png"
alt="Evil Rabbit"
/>
<AvatarFallback>E</AvatarFallback>
</Avatar>
<div>
<p className="text-sm font-semibold">Evil Rabbit</p>
<p className="text-xs text-muted-foreground">Design engineer</p>
</div>
</div>
</div>
</div>
</main>
)
}





























