From 50f714d7b8a5e0c66e8db41f939cf2a964663931 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sat, 17 Jun 2023 12:06:25 -0700 Subject: more ui details --- extension/react-app/src/components/CodeBlock.tsx | 63 +++++++---- extension/react-app/src/components/ComboBox.tsx | 22 +++- .../react-app/src/components/StepContainer.tsx | 118 +++++++++------------ extension/react-app/src/components/TextDialog.tsx | 77 +++++++++----- extension/react-app/src/components/index.ts | 20 ---- extension/react-app/src/index.css | 5 +- extension/react-app/src/tabs/gui.tsx | 2 + 7 files changed, 164 insertions(+), 143 deletions(-) (limited to 'extension/react-app/src') diff --git a/extension/react-app/src/components/CodeBlock.tsx b/extension/react-app/src/components/CodeBlock.tsx index eedae3fb..c4524a51 100644 --- a/extension/react-app/src/components/CodeBlock.tsx +++ b/extension/react-app/src/components/CodeBlock.tsx @@ -1,44 +1,62 @@ import hljs from "highlight.js"; -import { useEffect } from "react"; +import { useEffect, useState } from "react"; import styled from "styled-components"; -import { defaultBorderRadius, vscBackground } from "."; +import { defaultBorderRadius, secondaryDark, vscBackground } from "."; -import { Clipboard } from "@styled-icons/heroicons-outline"; +import { Clipboard, CheckCircle } from "@styled-icons/heroicons-outline"; const StyledPre = styled.pre` overflow-y: scroll; word-wrap: normal; - border: 1px solid gray; + border: 0.5px solid gray; border-radius: ${defaultBorderRadius}; - background-color: ${vscBackground}; + background-color: ${secondaryDark}; padding: 8px; + padding-top: 14px; + padding-bottom: 16px; `; -const StyledCode = styled.code` - background-color: ${vscBackground}; -`; +const StyledCode = styled.code``; -const StyledCopyButton = styled.button` +const StyledCopyButton = styled.button<{ visible: boolean }>` + /* position: relative; */ float: right; border: none; - background-color: ${vscBackground}; + background-color: transparent; cursor: pointer; padding: 0; - margin: 4px; - &:hover { - color: #fff; - } + /* margin: 4px; */ + margin-top: -6px; + + visibility: ${(props) => (props.visible ? "visible" : "hidden")}; `; -function CopyButton(props: { textToCopy: string }) { +function CopyButton(props: { textToCopy: string; visible: boolean }) { + const [hovered, setHovered] = useState(false); + const [clicked, setClicked] = useState(false); return ( <> { + setHovered(true); + }} + onMouseLeave={() => { + setHovered(false); + }} + visible={clicked || props.visible} onClick={() => { navigator.clipboard.writeText(props.textToCopy); + setClicked(true); + setTimeout(() => { + setClicked(false); + }, 2000); }} > - + {clicked ? ( + + ) : ( + + )} ); @@ -48,9 +66,18 @@ function CodeBlock(props: { language?: string; children: string }) { useEffect(() => { hljs.highlightAll(); }, [props.children]); + const [hovered, setHovered] = useState(false); + return ( - - + { + setHovered(true); + }} + onMouseLeave={() => { + setHovered(false); + }} + > + {props.children} ); diff --git a/extension/react-app/src/components/ComboBox.tsx b/extension/react-app/src/components/ComboBox.tsx index e855ebe5..ddc9d5dc 100644 --- a/extension/react-app/src/components/ComboBox.tsx +++ b/extension/react-app/src/components/ComboBox.tsx @@ -9,16 +9,22 @@ import { } from "."; const mainInputFontSize = 16; -const MainTextInput = styled.input` +const MainTextInput = styled.textarea` + resize: none; + padding: 8px; font-size: ${mainInputFontSize}px; border-radius: ${defaultBorderRadius}; - border: 1px solid #ccc; + border: 1px solid white; margin: 8px auto; width: 100%; background-color: ${vscBackground}; color: white; - outline: 1px solid orange; + + &:focus { + border: 1px solid transparent; + outline: 1px solid orange; + } `; const UlMaxHeight = 200; @@ -108,10 +114,16 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {