mirror of
https://github.com/hanzoai/shadcn.git
synced 2026-11-02 10:35:35 +00:00
Fixed deployment issues for GitHub Pages static export: Server Component Fixes: - Added 'use client' to all login blocks (10 files) - Added 'use client' to all signup blocks (10 files) - Added 'use client' to all sidebar blocks (25 files) - Added 'use client' to all OTP blocks (10 files) - Fixed VersionSwitcher/SearchForm naming in sidebar-02 Registry Structure Fixes: - Updated getRegistryItem() to use Index[style][name] pattern - Updated getRegistryComponent() to accept style parameter - Removed problematic Zod validation in blocks.ts - Fixed null to undefined conversion in block metadata Build Compatibility: - Disabled Shiki syntax highlighting for static export - Added HTML fallback for code blocks Result: All 353 static pages now generate successfully
81 lines
2.3 KiB
TypeScript
81 lines
2.3 KiB
TypeScript
"use client"
|
|
|
|
import { Button } from "@/registry/default/ui/button"
|
|
import {
|
|
Card,
|
|
CardContent,
|
|
CardDescription,
|
|
CardHeader,
|
|
CardTitle,
|
|
} from "@/registry/default/ui/card"
|
|
import {
|
|
Field,
|
|
FieldDescription,
|
|
FieldGroup,
|
|
FieldLabel,
|
|
} from "@/registry/default/ui/field"
|
|
import {
|
|
InputOTP,
|
|
InputOTPGroup,
|
|
InputOTPSlot,
|
|
} from "@/registry/default/ui/input-otp"
|
|
|
|
export default function OTPPage() {
|
|
return (
|
|
<div className="flex min-h-svh w-full items-center justify-center p-6 md:p-10">
|
|
<div className="w-full max-w-xs">
|
|
<OTPForm04 />
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export function OTPForm04({ ...props }: React.ComponentProps<typeof Card>) {
|
|
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
|
|
e.preventDefault()
|
|
const formData = new FormData(e.currentTarget)
|
|
|
|
// TODO: Add your authentication logic here
|
|
console.log("Form submitted:", Object.fromEntries(formData))
|
|
|
|
// Example: await signIn(formData)
|
|
}
|
|
|
|
return (
|
|
<Card {...props}>
|
|
<CardHeader>
|
|
<CardTitle>Enter verification code</CardTitle>
|
|
<CardDescription>We sent a 6-digit code to your email.</CardDescription>
|
|
</CardHeader>
|
|
<CardContent>
|
|
<form onSubmit={handleSubmit}>
|
|
<FieldGroup>
|
|
<Field>
|
|
<FieldLabel htmlFor="otp">Verification code</FieldLabel>
|
|
<InputOTP maxLength={6} id="otp" name="otp" required>
|
|
<InputOTPGroup className="gap-2.5 *:data-[slot=input-otp-slot]:rounded-md *:data-[slot=input-otp-slot]:border">
|
|
<InputOTPSlot index={0} />
|
|
<InputOTPSlot index={1} />
|
|
<InputOTPSlot index={2} />
|
|
<InputOTPSlot index={3} />
|
|
<InputOTPSlot index={4} />
|
|
<InputOTPSlot index={5} />
|
|
</InputOTPGroup>
|
|
</InputOTP>
|
|
<FieldDescription>
|
|
Enter the 6-digit code sent to your email.
|
|
</FieldDescription>
|
|
</Field>
|
|
<FieldGroup>
|
|
<Button type="submit">Verify</Button>
|
|
<FieldDescription className="text-center">
|
|
Didn't receive the code? <a href="#">Resend</a>
|
|
</FieldDescription>
|
|
</FieldGroup>
|
|
</FieldGroup>
|
|
</form>
|
|
</CardContent>
|
|
</Card>
|
|
)
|
|
}
|