diff --git a/gui/src/components/ToggleDiv.tsx b/gui/src/components/ToggleDiv.tsx index 8e5e2ccb3..d9a115867 100644 --- a/gui/src/components/ToggleDiv.tsx +++ b/gui/src/components/ToggleDiv.tsx @@ -1,14 +1,16 @@ import { ChevronDownIcon, ChevronRightIcon } from "@heroicons/react/24/outline"; -import { useState } from "react"; +import { ComponentType, useState } from "react"; import { lightGray, vscBackground } from "."; interface ToggleProps { children: React.ReactNode; title: React.ReactNode; + icon?: ComponentType>; } -function ToggleDiv({ children, title }: ToggleProps) { +function ToggleDiv({ children, title, icon: Icon }: ToggleProps) { const [open, setOpen] = useState(false); + const [isHovered, setIsHovered] = useState(false); return (
setOpen((prev) => !prev)} + onMouseEnter={() => setIsHovered(true)} + onMouseLeave={() => setIsHovered(false)} data-testid="context-items-peek" >
- - + {Icon && !isHovered ? ( + + ) : ( + <> + + + + )}
{title} diff --git a/gui/src/components/mainInput/belowMainInput/ContextItemsPeek.tsx b/gui/src/components/mainInput/belowMainInput/ContextItemsPeek.tsx index 02a26b9c7..20b7b6e83 100644 --- a/gui/src/components/mainInput/belowMainInput/ContextItemsPeek.tsx +++ b/gui/src/components/mainInput/belowMainInput/ContextItemsPeek.tsx @@ -2,7 +2,7 @@ import { ArrowTopRightOnSquareIcon } from "@heroicons/react/24/outline"; import { ContextItemWithId } from "core"; import { ctxItemToRifWithContents } from "core/commands/util"; import { getUriPathBasename } from "core/util/uri"; -import { useContext, useMemo } from "react"; +import { ComponentType, useContext, useMemo } from "react"; import { AnimatedEllipsis } from "../.."; import { IdeMessengerContext } from "../../../context/IdeMessenger"; import { useAppSelector } from "../../../redux/hooks"; @@ -16,6 +16,7 @@ import { NAMED_ICONS } from "../icons"; interface ContextItemsPeekProps { contextItems?: ContextItemWithId[]; isCurrentContextPeek: boolean; + icon?: ComponentType>; } interface ContextItemsPeekItemProps { @@ -150,6 +151,7 @@ function ContextItemsPeekItem({ contextItem }: ContextItemsPeekItemProps) { function ContextItemsPeek({ contextItems, isCurrentContextPeek, + icon, }: ContextItemsPeekProps) { const ctxItems = useMemo(() => { return contextItems?.filter((ctxItem) => !ctxItem.hidden) ?? []; @@ -165,6 +167,7 @@ function ContextItemsPeek({ return (