Skip to content

Commit 42b2192

Browse files
authored
Merge branch 'main' into main
2 parents fa9a3c3 + 6ef848e commit 42b2192

File tree

4 files changed

+1005
-494
lines changed

4 files changed

+1005
-494
lines changed

client/src/components/Sidebar/HomeSidebar.tsx

Lines changed: 20 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -6,125 +6,34 @@ import { Link } from 'react-router-dom';
66
import { motion } from 'framer-motion';
77

88
interface HomeProps {
9-
onLogout: () => void;
10-
username: string;
9+
onLogout: () => void;
10+
username: string;
1111
}
1212

1313
const HomeSidebar: React.FC<HomeProps> = ({ onLogout, username }) => {
14-
const navigate = useNavigate();
14+
const navigate = useNavigate();
1515

16-
const handleLogout = async () => {
17-
try {
18-
await onLogout();
19-
navigate('/');
20-
} catch (error) {
21-
console.error('Logout failed:', error);
22-
}
23-
};
16+
const handleLogout = async () => {
17+
try {
18+
await onLogout();
19+
navigate('/');
20+
} catch (error) {
21+
console.error('Logout failed:', error);
22+
}
23+
};
2424

25-
const goToProfile = () => {
26-
navigate(`/u/${username}`);
27-
};
25+
const goToProfile = () => {
26+
navigate(`/u/${username}`);
27+
};
2828

29-
const goToHome = () => {
30-
navigate('/home');
31-
};
29+
const goToHome = () => {
30+
navigate('/home');
31+
};
3232

33-
const links = [
34-
{
35-
label: 'Dashboard',
36-
href: '#',
37-
icon: (
38-
<IconBrandTabler className='text-neutral-700 dark:text-neutral-200 h-5 w-5 flex-shrink-0' />
39-
),
40-
onClick: goToHome,
41-
},
42-
];
4333

44-
const [open, setOpen] = useState(false);
34+
const [open, setOpen] = useState(false);
4535

46-
return (
47-
<Sidebar
48-
open={open}
49-
setOpen={setOpen}>
50-
<SidebarBody className='justify-between gap-10 h-screen'>
51-
<div className='flex flex-col flex-1 overflow-y-auto overflow-x-hidden'>
52-
{open ? <Logo /> : <LogoIcon />}
53-
<div className='mt-8 flex flex-col gap-2'>
54-
{links.map((link, idx) => (
55-
<SidebarLink
56-
key={idx}
57-
link={link}
58-
/>
59-
))}
60-
</div>
61-
</div>
62-
<div>
63-
<SidebarLink
64-
link={{
65-
label: username,
66-
href: '#',
67-
icon: (
68-
<img
69-
src='https://img.freepik.com/free-vector/user-blue-gradient_78370-4692.jpg?size=338&ext=jpg&ga=GA1.1.1700460183.1712707200&semt=ais'
70-
className='h-7 w-7 flex-shrink-0 rounded-full'
71-
width={50}
72-
height={50}
73-
alt='Avatar'
74-
/>
75-
),
76-
onClick: goToProfile,
77-
}}
78-
/>
79-
<SidebarLink
80-
link={{
81-
label: 'Logout',
82-
href: '#',
83-
icon: (
84-
<IconArrowLeft className='text-neutral-700 dark:text-neutral-200 h-5 w-5 flex-shrink-0' />
85-
),
86-
onClick: handleLogout,
87-
}}
88-
/>
89-
</div>
90-
</SidebarBody>
91-
</Sidebar>
92-
);
36+
return()
9337
};
9438

95-
export const Logo = () => {
96-
return (
97-
<Link
98-
to='#'
99-
className='font-normal flex space-x-2 items-center text-sm text-black py-1 relative z-20'>
100-
{/* <div className="h-5 w-6 bg-black dark:bg-white rounded-br-lg rounded-tr-sm rounded-tl-lg rounded-bl-sm flex-shrink-0" /> */}
101-
<h1
102-
style={{ fontSize: '1.3rem', fontWeight: 'bold' }}
103-
className='font-medium text-black dark:text-white whitespace-pre'>
104-
dh
105-
</h1>
106-
<motion.span
107-
initial={{ opacity: 0 }}
108-
animate={{ opacity: 1 }}
109-
className='font-medium text-black dark:text-white whitespace-pre'>
110-
Devhub
111-
</motion.span>
112-
</Link>
113-
);
114-
};
115-
116-
export const LogoIcon = () => {
117-
return (
118-
<Link
119-
to='#'
120-
className='font-normal flex space-x-2 items-center text-sm text-black py-1 relative z-20'>
121-
<h1
122-
style={{ fontSize: '1.3rem', fontWeight: 'bold' }}
123-
className='font-medium text-black dark:text-white whitespace-pre'>
124-
dh
125-
</h1>
126-
</Link>
127-
);
128-
};
129-
130-
export default HomeSidebar;
39+
export default HomeSidebar;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { cn } from "@/lib/utils"
2+
3+
function Skeleton({
4+
className,
5+
...props
6+
}: React.HTMLAttributes<HTMLDivElement>) {
7+
return (
8+
<div
9+
className={cn("animate-pulse rounded-md bg-muted", className)}
10+
{...props}
11+
/>
12+
)
13+
}
14+
15+
export { Skeleton }

0 commit comments

Comments
 (0)