summaryrefslogtreecommitdiff
path: root/extension/react-app/src/components/UserInputContainer.tsx
blob: 7e964ad96f00286619a8753aa7061c4daca8d805 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import React from "react";
import ReactMarkdown from "react-markdown";
import styled from "styled-components";
import { secondaryDark, vscBackground } from ".";
import HeaderButtonWithText from "./HeaderButtonWithText";
import { XMarkIcon } from "@heroicons/react/24/outline";
import { HistoryNode } from "../../../schema/HistoryNode";
import StyledMarkdownPreview from "./StyledMarkdownPreview";

interface UserInputContainerProps {
  onDelete: () => void;
  children: string;
  historyNode: HistoryNode;
}

const StyledDiv = styled.div`
  position: relative;
  background-color: ${secondaryDark};
  font-size: 13px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid ${vscBackground};
  padding: 8px;
  padding-top: 4px;
  padding-bottom: 4px;
`;

const DeleteButtonDiv = styled.div`
  position: absolute;
  top: 8px;
  right: 16px;
`;

const UserInputContainer = (props: UserInputContainerProps) => {
  return (
    <StyledDiv>
      <StyledMarkdownPreview
        light={true}
        source={props.children}
        className="mr-6"
      />
      {/* <ReactMarkdown children={props.children} className="w-fit mr-10" /> */}
      <DeleteButtonDiv>
        <HeaderButtonWithText
          onClick={(e) => {
            props.onDelete();
            e.stopPropagation();
          }}
          text="Delete"
        >
          <XMarkIcon width="1.4em" height="1.4em" />
        </HeaderButtonWithText>
      </DeleteButtonDiv>
    </StyledDiv>
  );
};
export default UserInputContainer;