@@ -6,125 +6,34 @@ import { Link } from 'react-router-dom';
6
6
import { motion } from 'framer-motion' ;
7
7
8
8
interface HomeProps {
9
- onLogout : ( ) => void ;
10
- username : string ;
9
+ onLogout : ( ) => void ;
10
+ username : string ;
11
11
}
12
12
13
13
const HomeSidebar : React . FC < HomeProps > = ( { onLogout, username } ) => {
14
- const navigate = useNavigate ( ) ;
14
+ const navigate = useNavigate ( ) ;
15
15
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
+ } ;
24
24
25
- const goToProfile = ( ) => {
26
- navigate ( `/u/${ username } ` ) ;
27
- } ;
25
+ const goToProfile = ( ) => {
26
+ navigate ( `/u/${ username } ` ) ;
27
+ } ;
28
28
29
- const goToHome = ( ) => {
30
- navigate ( '/home' ) ;
31
- } ;
29
+ const goToHome = ( ) => {
30
+ navigate ( '/home' ) ;
31
+ } ;
32
32
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
- ] ;
43
33
44
- const [ open , setOpen ] = useState ( false ) ;
34
+ const [ open , setOpen ] = useState ( false ) ;
45
35
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 ( )
93
37
} ;
94
38
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 ;
0 commit comments