Components
Loading preview...
Here is Dialog component
npx shadcn@latest add https://21st.dev/r/anubra266/dialog-2"use client";
import { Dialog } from "@ark-ui/react/dialog";
import { Portal } from "@ark-ui/react/portal";
import { X, LogIn } from "lucide-react";
import { useState } from "react";
export default function SignInDialog() {
const [formData, setFormData] = useState({
email: "",
password: "",
rememberMe: false,
});
const handleInputChange = (field: string, value: string | boolean) => {
setFormData((prev) => ({ ...prev, [field]: value }));
};
return (
<Dialog.Root>
<Dialog.Trigger asChild>
<button className="rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 px-4 py-2 text-sm text-gray-900 dark:text-gray-100 hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors cursor-pointer inline-flex items-center justify-center">
Sign In
</button>
</Dialog.Trigger>
<Portal>
<Dialog.Backdrop className="data-[state=open]:animate-backdrop-in data-[state=closed]:animate-backdrop-out fixed inset-0 z-50 bg-black/50 backdrop-blur-xs" />
<Dialog.Positioner className="fixed inset-0 z-50 flex items-center justify-center p-4">
<Dialog.Content className="data-[state=open]:animate-dialog-in data-[state=closed]:animate-dialog-out relative w-full max-w-sm rounded-lg bg-white dark:bg-gray-900 p-5 shadow-lg">
<Dialog.CloseTrigger asChild>
<button className="absolute right-3 top-3 p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors cursor-pointer">
<X className="h-4 w-4" />
</button>
</Dialog.CloseTrigger>
<div className="space-y-4">
<div className="flex items-start space-x-3">
<div className="flex h-10 w-10 items-center justify-center rounded-full border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800">
<LogIn className="h-5 w-5 text-gray-600 dark:text-white" />
</div>
<div className="space-y-1">
<Dialog.Title className="text-lg font-semibold text-gray-900 dark:text-white">
Sign in
</Dialog.Title>
<Dialog.Description className="text-sm text-gray-600 dark:text-gray-400">
Welcome back! Please sign in to continue.
</Dialog.Description>
</div>
</div>
<div className="space-y-3">
<div className="space-y-1">
<label className="block text-xs font-medium text-gray-700 dark:text-gray-300">
Email
</label>
<input
type="email"
value={formData.email}
onChange={(e) => handleInputChange("email", e.target.value)}
className="w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:outline-hidden focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 transition-colors"
/>
</div>
<div className="space-y-1">
<label className="block text-xs font-medium text-gray-700 dark:text-gray-300">
Password
</label>
<input
type="password"
value={formData.password}
onChange={(e) =>
handleInputChange("password", e.target.value)
}
className="w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:outline-hidden focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 transition-colors"
/>
</div>
<div className="flex items-center justify-between">
<div className="flex items-center space-x-2">
<input
type="checkbox"
id="rememberMe"
checked={formData.rememberMe}
onChange={(e) =>
handleInputChange("rememberMe", e.target.checked)
}
className="w-3 h-3 border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 focus:ring-0 focus:ring-offset-0"
/>
<label
htmlFor="rememberMe"
className="text-xs text-gray-600 dark:text-gray-400 cursor-pointer"
>
Remember me
</label>
</div>
<button className="text-xs text-blue-600 dark:text-blue-400 hover:underline">
Forgot password?
</button>
</div>
<Dialog.CloseTrigger asChild>
<button className="w-full px-3 py-2 text-sm bg-gray-900 dark:bg-white text-white dark:text-gray-900 hover:bg-gray-800 dark:hover:bg-gray-100 rounded-md transition-colors cursor-pointer inline-flex items-center justify-center font-medium">
Sign in
</button>
</Dialog.CloseTrigger>
<Dialog.CloseTrigger asChild>
<button className="w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-white hover:bg-gray-50 dark:hover:bg-gray-700 rounded-md transition-colors cursor-pointer inline-flex items-center justify-center">
Continue with Google
</button>
</Dialog.CloseTrigger>
</div>
</div>
</Dialog.Content>
</Dialog.Positioner>
</Portal>
</Dialog.Root>
);
}