1
1
"use client" ;
2
- import { Sheet , SheetContent , SheetTrigger } from "@/components/ui/sheet" ;
3
2
import { ScrollArea } from "@/components/ui/scroll-area" ;
4
- import { Button } from "@/components/ui/button" ;
5
- import { Menu } from "lucide-react" ;
6
3
import { TreeView } from "@/components/tree-view" ;
7
- import { useState } from "react" ;
8
- import { DialogTitle , DialogDescription } from "@radix-ui/react-dialog" ;
9
4
import { usePosts } from "@/contexts/posts-context" ;
10
5
import { buildFolderStructure } from "@/lib/utils" ;
11
6
import { cn } from "@/lib/utils" ;
@@ -19,7 +14,6 @@ interface LeftSidebarProps {
19
14
}
20
15
21
16
export default function LeftSidebar ( { className } : LeftSidebarProps ) {
22
- const [ open , setOpen ] = useState ( false ) ;
23
17
const { posts } = usePosts ( ) ;
24
18
const pathname = usePathname ( ) ;
25
19
const folderStructure = buildFolderStructure ( posts ) ;
@@ -30,93 +24,6 @@ export default function LeftSidebar({ className }: LeftSidebarProps) {
30
24
return (
31
25
< >
32
26
{ /* 모바일 버전 */ }
33
- < Sheet open = { open } onOpenChange = { setOpen } >
34
- < DialogTitle hidden = { true } > </ DialogTitle >
35
- < DialogDescription hidden = { true } > </ DialogDescription >
36
- < SheetTrigger asChild className = "hidden" >
37
- < Button id = "sidebar-trigger" variant = "outline" size = "icon" >
38
- < Menu className = "h-4 w-4" />
39
- </ Button >
40
- </ SheetTrigger >
41
- < SheetContent
42
- side = "left"
43
- className = "w-[280px] sm:w-[320px] md:w-[360px] p-0 pt-10 sm:pt-12"
44
- onCloseAutoFocus = { ( e ) => e . preventDefault ( ) }
45
- >
46
- < div className = "relative h-full" >
47
- < ScrollArea className = "h-full p-3 sm:p-4" >
48
- { /* 네비게이션 링크 추가 */ }
49
- < div className = "mb-6 px-1 sm:px-2" >
50
- < h2 className = "text-lg font-semibold mb-3" >
51
- 메뉴
52
- </ h2 >
53
- < div className = "flex flex-col space-y-2" >
54
- < Link
55
- href = "/"
56
- className = { `flex items-center px-3 py-2 rounded-md transition-colors ${
57
- pathname === "/"
58
- ? "bg-primary/10 text-primary font-medium"
59
- : "hover:bg-accent"
60
- } `}
61
- onClick = { ( ) => setOpen ( false ) }
62
- >
63
- < svg
64
- xmlns = "http://www.w3.org/2000/svg"
65
- className = "w-5 h-5 mr-2"
66
- viewBox = "0 0 24 24"
67
- fill = "none"
68
- stroke = "currentColor"
69
- strokeWidth = "2"
70
- strokeLinecap = "round"
71
- strokeLinejoin = "round"
72
- >
73
- < path d = "m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" > </ path >
74
- < polyline points = "9 22 9 12 15 12 15 22" > </ polyline >
75
- </ svg >
76
- 홈
77
- </ Link >
78
- < Link
79
- href = "/projects"
80
- className = { `flex items-center px-3 py-2 rounded-md transition-colors ${
81
- pathname === "/projects"
82
- ? "bg-primary/10 text-primary font-medium"
83
- : "hover:bg-accent"
84
- } `}
85
- onClick = { ( ) => setOpen ( false ) }
86
- >
87
- < svg
88
- xmlns = "http://www.w3.org/2000/svg"
89
- className = "w-5 h-5 mr-2"
90
- viewBox = "0 0 24 24"
91
- fill = "none"
92
- stroke = "currentColor"
93
- strokeWidth = "2"
94
- strokeLinecap = "round"
95
- strokeLinejoin = "round"
96
- >
97
- < path d = "M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z" > </ path >
98
- < polyline points = "7.5 4.21 12 6.81 16.5 4.21" > </ polyline >
99
- < polyline points = "7.5 19.79 7.5 14.6 3 12" > </ polyline >
100
- < polyline points = "21 12 16.5 14.6 16.5 19.79" > </ polyline >
101
- < polyline points = "3.27 6.96 12 12.01 20.73 6.96" > </ polyline >
102
- < line x1 = "12" y1 = "22.08" x2 = "12" y2 = "12" > </ line >
103
- </ svg >
104
- 포트폴리오
105
- </ Link >
106
- </ div >
107
- </ div >
108
-
109
- < h2 className = "text-lg font-semibold mb-3 sm:mb-4 px-1 sm:px-2" >
110
- 카테고리
111
- </ h2 >
112
- < TreeView
113
- key = { `mobile-tree-${ pathname } ` }
114
- data = { folderStructure }
115
- />
116
- </ ScrollArea >
117
- </ div >
118
- </ SheetContent >
119
- </ Sheet >
120
27
121
28
{ /* 데스크톱 버전 */ }
122
29
< motion . aside
@@ -139,45 +46,45 @@ export default function LeftSidebar({ className }: LeftSidebarProps) {
139
46
transition = { { delay : 0.05 , duration : 0.1 } }
140
47
>
141
48
< div className = "flex flex-col space-y-2 px-1 py-1" >
142
- < Link
49
+ < Link
143
50
href = "/"
144
51
className = { `flex items-center px-3 py-2 rounded-md transition-colors ${
145
- pathname === "/"
146
- ? "bg-primary/10 text-primary font-medium"
52
+ pathname === "/"
53
+ ? "bg-primary/10 text-primary font-medium"
147
54
: "hover:bg-accent"
148
55
} `}
149
56
>
150
- < svg
151
- xmlns = "http://www.w3.org/2000/svg"
152
- className = "w-5 h-5 mr-2"
153
- viewBox = "0 0 24 24"
154
- fill = "none"
155
- stroke = "currentColor"
156
- strokeWidth = "2"
157
- strokeLinecap = "round"
57
+ < svg
58
+ xmlns = "http://www.w3.org/2000/svg"
59
+ className = "w-5 h-5 mr-2"
60
+ viewBox = "0 0 24 24"
61
+ fill = "none"
62
+ stroke = "currentColor"
63
+ strokeWidth = "2"
64
+ strokeLinecap = "round"
158
65
strokeLinejoin = "round"
159
66
>
160
67
< path d = "m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" > </ path >
161
68
< polyline points = "9 22 9 12 15 12 15 22" > </ polyline >
162
69
</ svg >
163
70
홈
164
71
</ Link >
165
- < Link
72
+ < Link
166
73
href = "/projects"
167
74
className = { `flex items-center px-3 py-2 rounded-md transition-colors ${
168
- pathname === "/projects"
169
- ? "bg-primary/10 text-primary font-medium"
75
+ pathname === "/projects"
76
+ ? "bg-primary/10 text-primary font-medium"
170
77
: "hover:bg-accent"
171
78
} `}
172
79
>
173
- < svg
174
- xmlns = "http://www.w3.org/2000/svg"
175
- className = "w-5 h-5 mr-2"
176
- viewBox = "0 0 24 24"
177
- fill = "none"
178
- stroke = "currentColor"
179
- strokeWidth = "2"
180
- strokeLinecap = "round"
80
+ < svg
81
+ xmlns = "http://www.w3.org/2000/svg"
82
+ className = "w-5 h-5 mr-2"
83
+ viewBox = "0 0 24 24"
84
+ fill = "none"
85
+ stroke = "currentColor"
86
+ strokeWidth = "2"
87
+ strokeLinecap = "round"
181
88
strokeLinejoin = "round"
182
89
>
183
90
< path d = "M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z" > </ path >
@@ -192,7 +99,7 @@ export default function LeftSidebar({ className }: LeftSidebarProps) {
192
99
</ div >
193
100
</ motion . div >
194
101
</ SidebarSection >
195
-
102
+
196
103
< SidebarSection title = "카테고리" >
197
104
< motion . div
198
105
initial = { { opacity : 0 } }
0 commit comments