Skip to content

Commit 73dc070

Browse files
committed
refactor: Make TreeView onNodeClick prop optional
1 parent 65b7d7e commit 73dc070

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

components/left-sidebar.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ export default function LeftSidebar({ className }: LeftSidebarProps) {
5555
<Link
5656
href="/"
5757
className={`flex items-center px-3 py-2 rounded-md transition-colors ${pathname === "/"
58-
? "bg-primary/10 text-primary font-medium"
59-
: "hover:bg-accent"
58+
? "bg-primary/10 text-primary font-medium"
59+
: "hover:bg-accent"
6060
}`}
6161
>
6262
<svg
@@ -77,8 +77,8 @@ export default function LeftSidebar({ className }: LeftSidebarProps) {
7777
<Link
7878
href="/projects"
7979
className={`flex items-center px-3 py-2 rounded-md transition-colors ${pathname === "/projects"
80-
? "bg-primary/10 text-primary font-medium"
81-
: "hover:bg-accent"
80+
? "bg-primary/10 text-primary font-medium"
81+
: "hover:bg-accent"
8282
}`}
8383
>
8484
<svg
@@ -112,7 +112,6 @@ export default function LeftSidebar({ className }: LeftSidebarProps) {
112112
<TreeView
113113
key={`desktop-tree-${pathname}`}
114114
data={folderStructure}
115-
onNodeClick={() => { }}
116115
/>
117116
</motion.div>
118117
</SidebarSection>

components/tree-view.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface TreeViewProps {
1111
data: FolderStructure[];
1212
level?: number;
1313
parentPath?: string;
14-
onNodeClick: () => void;
14+
onNodeClick?: () => void;
1515
}
1616

1717
export function TreeView({ data, level = 0, parentPath = "", onNodeClick }: TreeViewProps) {
@@ -23,7 +23,7 @@ export function TreeView({ data, level = 0, parentPath = "", onNodeClick }: Tree
2323
node={item}
2424
level={level}
2525
parentPath={parentPath}
26-
onNodeClick={onNodeClick}
26+
onNodeClick={onNodeClick ? onNodeClick : () => { }}
2727
/>
2828
))}
2929
</div>

0 commit comments

Comments
 (0)