generated from muhtadeetaron/nextjs-template
fix(ui): fix profile screen
This commit is contained in:
129
components/ProfileManager.tsx
Normal file
129
components/ProfileManager.tsx
Normal file
@ -0,0 +1,129 @@
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
|
||||
interface UserData {
|
||||
name: string;
|
||||
institution: string;
|
||||
sscRoll: string;
|
||||
hscRoll: string;
|
||||
email: string;
|
||||
phone: string;
|
||||
}
|
||||
|
||||
interface ProfileManagerProps {
|
||||
userData: UserData | undefined;
|
||||
edit: boolean;
|
||||
}
|
||||
|
||||
export default function ProfileManager({
|
||||
userData,
|
||||
edit,
|
||||
}: ProfileManagerProps) {
|
||||
return (
|
||||
<div className="mx-auto">
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<Label
|
||||
htmlFor="name"
|
||||
className="text-sm font-semibold tracking-tighter text-gray-700"
|
||||
>
|
||||
Name
|
||||
</Label>
|
||||
<Input
|
||||
id="name"
|
||||
type="text"
|
||||
value={userData?.name}
|
||||
readOnly
|
||||
className="bg-gray-50 cursor-default py-6"
|
||||
disabled={!edit}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label
|
||||
htmlFor="institution"
|
||||
className="text-sm font-semibold tracking-tighter text-gray-700"
|
||||
>
|
||||
Institution
|
||||
</Label>
|
||||
<Input
|
||||
id="institution"
|
||||
type="text"
|
||||
value={userData?.institution}
|
||||
readOnly
|
||||
className="bg-gray-50 cursor-default py-6"
|
||||
disabled={!edit}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label
|
||||
htmlFor="sscRoll"
|
||||
className="text-sm font-semibold tracking-tighter text-gray-700"
|
||||
>
|
||||
SSC Roll
|
||||
</Label>
|
||||
<Input
|
||||
id="sscRoll"
|
||||
type="text"
|
||||
value={userData?.sscRoll}
|
||||
readOnly
|
||||
className="bg-gray-50 cursor-default py-6"
|
||||
disabled={!edit}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label
|
||||
htmlFor="hscRoll"
|
||||
className="text-sm font-semibold tracking-tighter text-gray-700"
|
||||
>
|
||||
HSC Roll
|
||||
</Label>
|
||||
<Input
|
||||
id="hscRoll"
|
||||
type="text"
|
||||
value={userData?.hscRoll}
|
||||
readOnly
|
||||
className="bg-gray-50 cursor-default py-6"
|
||||
disabled={!edit}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label
|
||||
htmlFor="email"
|
||||
className="text-sm font-semibold tracking-tighter text-gray-700"
|
||||
>
|
||||
Email
|
||||
</Label>
|
||||
<Input
|
||||
id="email"
|
||||
type="email"
|
||||
value={userData?.email}
|
||||
readOnly
|
||||
className="bg-gray-50 cursor-default py-6"
|
||||
disabled={!edit}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label
|
||||
htmlFor="phone"
|
||||
className="text-sm font-semibold tracking-tighter text-gray-700"
|
||||
>
|
||||
Phone
|
||||
</Label>
|
||||
<Input
|
||||
id="phone"
|
||||
type="tel"
|
||||
value={userData?.phone}
|
||||
readOnly
|
||||
className="bg-gray-50 cursor-default py-6"
|
||||
disabled={!edit}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
21
components/ui/input.tsx
Normal file
21
components/ui/input.tsx
Normal file
@ -0,0 +1,21 @@
|
||||
import * as React from "react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
||||
return (
|
||||
<input
|
||||
type={type}
|
||||
data-slot="input"
|
||||
className={cn(
|
||||
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
||||
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
||||
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export { Input }
|
||||
24
components/ui/label.tsx
Normal file
24
components/ui/label.tsx
Normal file
@ -0,0 +1,24 @@
|
||||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
import * as LabelPrimitive from "@radix-ui/react-label"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
function Label({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof LabelPrimitive.Root>) {
|
||||
return (
|
||||
<LabelPrimitive.Root
|
||||
data-slot="label"
|
||||
className={cn(
|
||||
"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export { Label }
|
||||
Reference in New Issue
Block a user