From 2b35e5f5cff948ca7d4f207b23db68f0da248a95 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sat, 9 Sep 2023 10:14:10 -0700 Subject: feat: :lipstick: add context button (plus icon) --- extension/react-app/src/components/ComboBox.tsx | 67 +++++++++++++++++++------ extension/react-app/src/pages/gui.tsx | 2 +- 2 files changed, 52 insertions(+), 17 deletions(-) (limited to 'extension') diff --git a/extension/react-app/src/components/ComboBox.tsx b/extension/react-app/src/components/ComboBox.tsx index cf7c4298..91c5facc 100644 --- a/extension/react-app/src/components/ComboBox.tsx +++ b/extension/react-app/src/components/ComboBox.tsx @@ -8,6 +8,7 @@ import React, { import { useCombobox } from "downshift"; import styled from "styled-components"; import { + StyledTooltip, defaultBorderRadius, lightGray, secondaryDark, @@ -21,6 +22,7 @@ import { DocumentPlusIcon, FolderArrowDownIcon, ArrowLeftIcon, + PlusIcon, } from "@heroicons/react/24/outline"; import { ContextItem } from "../../../schema/FullState"; import { postVscMessage } from "../vscode"; @@ -87,6 +89,23 @@ const MainTextInput = styled.textarea` } `; +const StyledPlusIcon = styled(PlusIcon)` + position: absolute; + right: 0px; + top: 0px; + height: fit-content; + padding: 0; + cursor: pointer; + border-radius: ${defaultBorderRadius}; + z-index: 2; + + background-color: ${vscBackground}; + + &:hover { + background-color: ${secondaryDark}; + } +`; + const UlMaxHeight = 300; const Ul = styled.ul<{ hidden: boolean; @@ -495,21 +514,6 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => { {props.selectedContextItems.length > 0 && ( <> - { - showDialogToSaveContextGroup(); - }} - className="pill-button focus:outline-none focus:border-red-600 focus:border focus:border-solid" - onKeyDown={(e: KeyboardEvent) => { - e.preventDefault(); - if (e.key === "Enter") { - showDialogToSaveContextGroup(); - } - }} - > - - {props.addingHighlightedCode ? ( { @@ -535,10 +539,29 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => { )} + { + showDialogToSaveContextGroup(); + }} + className="pill-button focus:outline-none focus:border-red-600 focus:border focus:border-solid" + onKeyDown={(e: KeyboardEvent) => { + e.preventDefault(); + if (e.key === "Enter") { + showDialogToSaveContextGroup(); + } + }} + > + + )} -