-
Notifications
You must be signed in to change notification settings - Fork 438
Expand file tree
/
Copy pathAboutMe.tsx
More file actions
80 lines (75 loc) · 2.2 KB
/
AboutMe.tsx
File metadata and controls
80 lines (75 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
'use client';
import { SquareUserRound, Pencil } from 'lucide-react';
import React, { useState } from 'react';
import { Button } from '@/components/ui/button';
import SheetWrapper from './sheets/SheetWrapper';
import { SHEETS } from '@/lib/constant/profile.constant';
import ProfileEmptyContainers from './emptycontainers/ProfileEmptyContainers';
import AboutMeForm from './forms/ReadMeForm';
const ProfileAboutMe = ({
aboutMe,
isOwner,
}: {
aboutMe: string;
isOwner: boolean;
}) => {
const [isSheetOpen, setIsSheetOpen] = useState<boolean>(false);
const title =
aboutMe.length === 0
? SHEETS.aboutMe.title
: SHEETS.aboutMe.title.replace('Add', 'Edit');
const handleClose = () => {
setIsSheetOpen(false);
};
const handleOpen = () => {
setIsSheetOpen(true);
};
return (
<>
<div className="flex justify-between items-center">
<h3 className="font-bold text-2xl">About Me</h3>
{isOwner && (
<Button
variant={'outline'}
className="px-3 py-2 rounded-xs text-slate-500 dark:text-slate-400 flex gap-2"
onClick={handleOpen}
>
<Pencil height={16} width={16} /> Edit
</Button>
)}
</div>
{!aboutMe && (
<ProfileEmptyContainers
isOwner={isOwner}
buttonText="Add About Me"
handleClick={handleOpen}
title={
isOwner ? 'You haven’t added an about me yet' : 'No About Me added.'
}
description={
isOwner
? 'Share a brief introduction to let companies know who you are.'
: ''
}
Icon={SquareUserRound}
/>
)}
{aboutMe && (
<div className="rounded-2xl p-6 dark:bg-slate-900 bg-slate-100">
<p className="sm:text-base text-sm leading-normal">{aboutMe}</p>
</div>
)}
{isOwner && (
<SheetWrapper
isOpen={isSheetOpen}
handleClose={handleClose}
title={title}
description={SHEETS.aboutMe.description}
>
<AboutMeForm handleClose={handleClose} aboutMe={aboutMe} />
</SheetWrapper>
)}
</>
);
};
export default ProfileAboutMe;