diff --git a/src/components/Layout/Sidebar/SidebarLink.tsx b/src/components/Layout/Sidebar/SidebarLink.tsx index aadb6cf4de5..22db9311eae 100644 --- a/src/components/Layout/Sidebar/SidebarLink.tsx +++ b/src/components/Layout/Sidebar/SidebarLink.tsx @@ -22,6 +22,7 @@ interface SidebarLinkProps { isExpanded?: boolean; hideArrow?: boolean; isPending: boolean; + onClick?: React.MouseEventHandler; } export function SidebarLink({ @@ -51,13 +52,17 @@ export function SidebarLink({ target = '_blank'; } return ( - tag or custom wrapper + > +
- {/* This here needs to be refactored ofc */} + )} + >
{title}{' '} {version === 'major' && ( + className="text-xs px-1 ms-1 rounded bg-gray-10 dark:bg-gray-40 dark:bg-opacity-20 text-gray-40 dark:text-gray-40" + > React 19 )} @@ -102,10 +108,13 @@ export function SidebarLink({ className={cn('pe-1', { 'text-link dark:text-link-dark': isExpanded, 'text-tertiary dark:text-tertiary-dark': !isExpanded, - })}> + })} + > )} - - ); +
+ +); + } diff --git a/src/components/Layout/Sidebar/SidebarRouteTree.tsx b/src/components/Layout/Sidebar/SidebarRouteTree.tsx index 72003df74f2..54f80ddd5fd 100644 --- a/src/components/Layout/Sidebar/SidebarRouteTree.tsx +++ b/src/components/Layout/Sidebar/SidebarRouteTree.tsx @@ -2,7 +2,8 @@ * Copyright (c) Facebook, Inc. and its affiliates. */ -import {useRef, useLayoutEffect, Fragment} from 'react'; +import { useRef, useLayoutEffect, Fragment, useState} from 'react'; + import cn from 'classnames'; import {useRouter} from 'next/router'; @@ -112,7 +113,15 @@ export function SidebarRouteTree({ const isBreadcrumb = breadcrumbs.length > 1 && breadcrumbs[breadcrumbs.length - 1].path === path; - const isExpanded = isForceExpanded || isBreadcrumb || selected; + + const [isExpanded, setIsExpanded] = useState( + isForceExpanded || isBreadcrumb || selected + ); + + const toggleExpand = (e: React.MouseEvent) => { + e.preventDefault(); + setIsExpanded(prev => !prev); + }; listItem = (