From f197e701a21e40f65b17ba2a5a25bb0cda7003f2 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sat, 17 Jun 2023 12:06:25 -0700 Subject: more ui details --- .../react-app/src/components/StepContainer.tsx | 118 +++++++++------------ 1 file changed, 50 insertions(+), 68 deletions(-) (limited to 'extension/react-app/src/components/StepContainer.tsx') diff --git a/extension/react-app/src/components/StepContainer.tsx b/extension/react-app/src/components/StepContainer.tsx index 4c98b04d..1eb1d1fd 100644 --- a/extension/react-app/src/components/StepContainer.tsx +++ b/extension/react-app/src/components/StepContainer.tsx @@ -5,14 +5,8 @@ import { defaultBorderRadius, secondaryDark, vscBackground, - GradientBorder, vscBackgroundTransparent, - HeaderButton, } from "."; -import { RangeInFile, FileEdit } from "../../../src/client"; -import CodeBlock from "./CodeBlock"; -import SubContainer from "./SubContainer"; - import { ChevronDown, ChevronRight, @@ -22,6 +16,7 @@ import { import { HistoryNode } from "../../../schema/HistoryNode"; import ReactMarkdown from "react-markdown"; import HeaderButtonWithText from "./HeaderButtonWithText"; +import CodeBlock from "./CodeBlock"; interface StepContainerProps { historyNode: HistoryNode; @@ -34,6 +29,8 @@ interface StepContainerProps { open: boolean; onToggleAll: () => void; onToggle: () => void; + isFirst: boolean; + isLast: boolean; } const MainDiv = styled.div<{ stepDepth: number; inFuture: boolean }>` @@ -67,12 +64,6 @@ const ContentDiv = styled.div` padding-left: 16px; `; -const OnHoverDiv = styled.div` - text-align: center; - padding: 10px; - animation: ${appear} 0.3s ease-in-out; -`; - const MarkdownPre = styled.pre` background-color: ${secondaryDark}; padding: 10px; @@ -80,7 +71,34 @@ const MarkdownPre = styled.pre` border: 0.5px solid white; `; -const MarkdownCode = styled.code``; +const StyledCode = styled.code` + word-wrap: break-word; + color: lightgray; +`; + +const GradientBorder = styled.div<{ + borderWidth?: number; + borderRadius?: string; + borderColor?: string; + isFirst: boolean; + isLast: boolean; +}>` + border-radius: ${(props) => props.borderRadius || "0"}; + padding-top: ${(props) => + `${(props.borderWidth || 1) / (props.isFirst ? 1 : 2)}px`}; + padding-bottom: ${(props) => + `${(props.borderWidth || 1) / (props.isLast ? 1 : 2)}px`}; + background: ${(props) => + props.borderColor + ? props.borderColor + : `linear-gradient( + 101.79deg, + #12887a 0%, + #87245c 37.64%, + #e12637 65.98%, + #ffb215 110.45% + )`}; +`; function StepContainer(props: StepContainerProps) { const [isHovered, setIsHovered] = useState(false); @@ -120,12 +138,14 @@ function StepContainer(props: StepContainerProps) { > { - if (props.open && e.metaKey) { + if (e.metaKey) { props.onToggleAll(); } else { props.onToggle(); @@ -198,66 +218,28 @@ function StepContainer(props: StepContainerProps) { { - // return ( - // - // ); - // }, - } - } + components={{ + pre: ({ node, ...props }) => { + return ( + + ); + }, + code: ({ node, ...props }) => { + return ( + + ); + }, + }} > {props.historyNode.step.description as any} )} - - {/* {props.historyNode.step.name === "Waiting for user input" && ( - { - props.onUserInput(value); - }} - > - )} - {props.historyNode.step.name === "Waiting for user confirmation" && ( - <> - - { - props.onUserInput("ok"); - e.preventDefault(); - e.stopPropagation(); - }} - type="button" - value="Confirm" - /> - - )} */} - - {/* */} ); } -- cgit v1.2.3-70-g09d2