Fixed sidebar buttons not being different when path is equal
This commit is contained in:
parent
eefac9ef48
commit
3d8a0acbc1
1 changed files with 8 additions and 2 deletions
|
|
@ -11,7 +11,10 @@ type SideBarButtonsComponentProps = {
|
||||||
pathname: string;
|
pathname: string;
|
||||||
handleOpenNewFolderModal?: () => void;
|
handleOpenNewFolderModal?: () => void;
|
||||||
};
|
};
|
||||||
const SideBarButtonsComponent = ({ items }: SideBarButtonsComponentProps) => {
|
const SideBarButtonsComponent = ({
|
||||||
|
items,
|
||||||
|
pathname,
|
||||||
|
}: SideBarButtonsComponentProps) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{items.map((item) => (
|
{items.map((item) => (
|
||||||
|
|
@ -21,7 +24,10 @@ const SideBarButtonsComponent = ({ items }: SideBarButtonsComponentProps) => {
|
||||||
data-testid={`sidebar-nav-${item.title}`}
|
data-testid={`sidebar-nav-${item.title}`}
|
||||||
className={cn(
|
className={cn(
|
||||||
buttonVariants({ variant: "ghost" }),
|
buttonVariants({ variant: "ghost" }),
|
||||||
"!w-[200px] cursor-pointer justify-start gap-2 border border-transparent hover:border-border hover:bg-transparent",
|
pathname === item.href
|
||||||
|
? "border border-border bg-muted hover:bg-muted"
|
||||||
|
: "border border-transparent hover:border-border hover:bg-transparent",
|
||||||
|
"w-full justify-start gap-2",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{item.title}
|
{item.title}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue