diff options
Diffstat (limited to 'extension/react-app/src/components/TextDialog.tsx')
-rw-r--r-- | extension/react-app/src/components/TextDialog.tsx | 77 |
1 files changed, 48 insertions, 29 deletions
diff --git a/extension/react-app/src/components/TextDialog.tsx b/extension/react-app/src/components/TextDialog.tsx index 31a385d5..e50a7686 100644 --- a/extension/react-app/src/components/TextDialog.tsx +++ b/extension/react-app/src/components/TextDialog.tsx @@ -3,6 +3,13 @@ import React, { useEffect, useState } from "react"; import styled from "styled-components"; import { Button, buttonColor, secondaryDark, vscBackground } from "."; +const ScreenCover = styled.div` + position: absolute; + width: 100%; + height: 100%; + background-color: rgba(168, 168, 168, 0.5); +`; + const DialogContainer = styled.div` position: absolute; top: 50%; @@ -28,9 +35,10 @@ const TextArea = styled.textarea` padding: 8px; outline: 1px solid black; font-family: Arial, Helvetica, sans-serif; + resize: none; &:focus { - outline: 1px solid orange; + outline: 1px solid ${buttonColor}; } `; @@ -54,34 +62,45 @@ const TextDialog = (props: { }, [props.showDialog]); return ( - <DialogContainer hidden={!props.showDialog}> - <Dialog> - <P>Thanks for your feedback. We'll get back to you soon!</P> - <TextArea - cols={50} - rows={10} - ref={textAreaRef} - onKeyDown={(e) => { - if (e.key === "Enter" && e.metaKey && textAreaRef.current) { - props.onEnter(textAreaRef.current.value); - setText(""); - } else if (e.key === "Escape") { - props.onClose(); - } - }} - /> - <Button - onClick={() => { - if (textAreaRef.current) { - props.onEnter(textAreaRef.current.value); - setText(""); - } - }} - > - Enter - </Button> - </Dialog> - </DialogContainer> + <ScreenCover + onClick={() => { + props.onClose(); + }} + hidden={!props.showDialog} + > + <DialogContainer + onClick={(e) => { + e.stopPropagation(); + }} + > + <Dialog> + <P>Thanks for your feedback. We'll get back to you soon!</P> + <TextArea + cols={50} + rows={10} + ref={textAreaRef} + onKeyDown={(e) => { + if (e.key === "Enter" && e.metaKey && textAreaRef.current) { + props.onEnter(textAreaRef.current.value); + setText(""); + } else if (e.key === "Escape") { + props.onClose(); + } + }} + /> + <Button + onClick={() => { + if (textAreaRef.current) { + props.onEnter(textAreaRef.current.value); + setText(""); + } + }} + > + Enter + </Button> + </Dialog> + </DialogContainer> + </ScreenCover> ); }; |