base profile
This commit is contained in:
@@ -0,0 +1,178 @@
|
||||
'use client'
|
||||
import React, { useState } from 'react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import Input from '@/components/Input'
|
||||
import { Edit2 } from 'lucide-react'
|
||||
import withLayout from '@/hoc/withLayout'
|
||||
import { Heart, ShoppingCart } from 'iconsax-react'
|
||||
|
||||
const ProfilePage = () => {
|
||||
const [userInfo, setUserInfo] = useState({
|
||||
name: 'حسین دهقانی',
|
||||
email: 'sondos@gmail.com',
|
||||
phone: '09010901789',
|
||||
nationalCode: '052093452',
|
||||
birthDate: '1365/5/8',
|
||||
postalCode: '1235478951',
|
||||
province: 'مرکزی',
|
||||
city: 'اراک',
|
||||
address: 'خیابان دانشگاه رودوی بیمارستان خوانساری ساختمان مهر طبقه سوم واحد2',
|
||||
district: '58'
|
||||
})
|
||||
|
||||
const [isEditing, setIsEditing] = useState(false)
|
||||
|
||||
const handleInputChange = (field: string, value: string) => {
|
||||
setUserInfo(prev => ({
|
||||
...prev,
|
||||
[field]: value
|
||||
}))
|
||||
}
|
||||
|
||||
const handleSubmit = () => {
|
||||
// Handle form submission
|
||||
setIsEditing(false)
|
||||
console.log('Form submitted:', userInfo)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="p-6">
|
||||
<div>
|
||||
<div className="flex gap-6">
|
||||
{/* Left Content - Form */}
|
||||
<div className="flex-1 ">
|
||||
<div className="bg-[#FAFAFA] rounded-lg p-6">
|
||||
<div className="flex items-center justify-between mb-6">
|
||||
<h1 className="text-lg font-bold text-gray-900">اطلاعات کاربری</h1>
|
||||
<Button
|
||||
onClick={() => setIsEditing(!isEditing)}
|
||||
variant="outline"
|
||||
className="flex items-center gap-2"
|
||||
>
|
||||
<Edit2 size={16} />
|
||||
ویرایش
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<Input
|
||||
label="نام و نام خانوادگی"
|
||||
value={userInfo.name}
|
||||
onChange={(e) => handleInputChange('name', e.target.value)}
|
||||
readOnly={!isEditing}
|
||||
/>
|
||||
|
||||
<Input
|
||||
label="کد ملی"
|
||||
value={userInfo.nationalCode}
|
||||
onChange={(e) => handleInputChange('nationalCode', e.target.value)}
|
||||
readOnly={!isEditing}
|
||||
/>
|
||||
|
||||
<Input
|
||||
label="ایمیل"
|
||||
value={userInfo.email}
|
||||
onChange={(e) => handleInputChange('email', e.target.value)}
|
||||
readOnly={!isEditing}
|
||||
type="email"
|
||||
/>
|
||||
|
||||
<Input
|
||||
label="شماره تماس"
|
||||
value={userInfo.phone}
|
||||
onChange={(e) => handleInputChange('phone', e.target.value)}
|
||||
readOnly={!isEditing}
|
||||
/>
|
||||
|
||||
<Input
|
||||
label="تاریخ تولد"
|
||||
value={userInfo.birthDate}
|
||||
onChange={(e) => handleInputChange('birthDate', e.target.value)}
|
||||
readOnly={!isEditing}
|
||||
/>
|
||||
|
||||
<Input
|
||||
label="استان"
|
||||
value={userInfo.province}
|
||||
onChange={(e) => handleInputChange('province', e.target.value)}
|
||||
readOnly={!isEditing}
|
||||
/>
|
||||
|
||||
<Input
|
||||
label="شهر"
|
||||
value={userInfo.city}
|
||||
onChange={(e) => handleInputChange('city', e.target.value)}
|
||||
readOnly={!isEditing}
|
||||
/>
|
||||
|
||||
<Input
|
||||
label="کد پستی"
|
||||
value={userInfo.postalCode}
|
||||
onChange={(e) => handleInputChange('postalCode', e.target.value)}
|
||||
readOnly={!isEditing}
|
||||
/>
|
||||
|
||||
<Input
|
||||
label="پلاک"
|
||||
value={userInfo.district}
|
||||
onChange={(e) => handleInputChange('district', e.target.value)}
|
||||
readOnly={!isEditing}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="mt-4">
|
||||
<Input
|
||||
label="آدرس"
|
||||
value={userInfo.address}
|
||||
onChange={(e) => handleInputChange('address', e.target.value)}
|
||||
readOnly={!isEditing}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{isEditing && (
|
||||
<div className="mt-6 flex gap-3">
|
||||
<Button
|
||||
onClick={handleSubmit}
|
||||
className="px-8 bg-blue-600 hover:bg-blue-700"
|
||||
>
|
||||
ذخیره تغییرات
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => setIsEditing(false)}
|
||||
variant="outline"
|
||||
>
|
||||
انصراف
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className='flex flex-col gap-6'>
|
||||
<div className='size-[240px] bg-[#FAFAFA] rounded-[10px] flex flex-col gap-6 justify-center items-center h-full'>
|
||||
<div className='size-20 bg-[#F2F2F2] rounded-full flex justify-center items-center'>
|
||||
<ShoppingCart size={40} color='#000' />
|
||||
</div>
|
||||
<div>
|
||||
سفارشات
|
||||
</div>
|
||||
</div>
|
||||
<div className='size-[240px] bg-[#FAFAFA] rounded-[10px] flex flex-col gap-6 justify-center items-center h-full'>
|
||||
<div className='size-20 bg-[#F2F2F2] rounded-full flex justify-center items-center'>
|
||||
<Heart size={40} color='#000' />
|
||||
</div>
|
||||
<div>
|
||||
علاقه مندی ها
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className='w-[300px] min-h-full bg-red-50 rounded-[10px]'>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default withLayout(ProfilePage)
|
||||
Reference in New Issue
Block a user