From b0e72321b428fb05a31b9e78a6988426a48db7d9 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 13 Dec 2024 20:43:38 +0100 Subject: [PATCH] FIX: Makes styling in Rename Sheet Dialog consistent with rest of dialogs --- webapp/src/components/navigation/menus.tsx | 135 ++++++++++++++++++--- 1 file changed, 117 insertions(+), 18 deletions(-) diff --git a/webapp/src/components/navigation/menus.tsx b/webapp/src/components/navigation/menus.tsx index 9510f2b..a41c4f8 100644 --- a/webapp/src/components/navigation/menus.tsx +++ b/webapp/src/components/navigation/menus.tsx @@ -1,17 +1,10 @@ -import { - Button, - Dialog, - DialogActions, - DialogContent, - DialogTitle, - TextField, - styled, -} from "@mui/material"; +import { Dialog, TextField, styled } from "@mui/material"; import Menu from "@mui/material/Menu"; import MenuItem from "@mui/material/MenuItem"; import { Check } from "lucide-react"; import { useState } from "react"; import { useTranslation } from "react-i18next"; +import { theme } from "../../theme"; import type { SheetOptions } from "./types"; function isWhiteColor(color: string): boolean { @@ -28,16 +21,48 @@ interface SheetRenameDialogProps { export const SheetRenameDialog = (properties: SheetRenameDialogProps) => { const { t } = useTranslation(); const [name, setName] = useState(properties.defaultName); + const handleClose = () => { + properties.close(); + }; return ( - {t("sheet_rename.title")} - - + {t("sheet_rename.title")} + {}}> + + Close + + + + + + + event.stopPropagation()} onKeyDown={(event) => { event.stopPropagation(); + if (event.key === "Enter") { + properties.onNameChanged(name); + properties.close(); + } }} onChange={(event) => { setName(event.target.value); @@ -45,16 +70,16 @@ export const SheetRenameDialog = (properties: SheetRenameDialogProps) => { spellCheck="false" onPaste={(event) => event.stopPropagation()} /> - - - - + + ); }; @@ -147,4 +172,78 @@ const ItemName = styled("div")` color: #333; `; +const StyledDialogTitle = styled("div")` + display: flex; + align-items: center; + height: 44px; + font-size: 14px; + font-weight: 500; + font-family: Inter; + padding: 0px 12px; + justify-content: space-between; + border-bottom: 1px solid ${theme.palette.grey["300"]}; +`; + +const Cross = styled("div")` + &:hover { + background-color: ${theme.palette.grey["100"]}; + } + display: flex; + border-radius: 4px; + height: 24px; + width: 24px; + cursor: pointer; + align-items: center; + justify-content: center; +`; + +const StyledDialogContent = styled("div")` + font-size: 12px; + margin: 12px; +`; + +const StyledTextField = styled(TextField)` + width: 100%; + border-radius: 4px; + overflow: hidden; + & .MuiInputBase-input { + font-size: 14px; + padding: 10px; + border: 1px solid ${theme.palette.grey["300"]}; + border-radius: 4px; + color: ${theme.palette.common.black}; + background-color: ${theme.palette.common.white}; + } + &:hover .MuiInputBase-input { + border: 1px solid ${theme.palette.grey["500"]}; + } +`; + +const DialogFooter = styled("div")` + color: #757575; + display: flex; + align-items: center; + border-top: 1px solid ${theme.palette.grey["300"]}; + font-family: Inter; + justify-content: flex-end; + padding: 12px; +`; + +const StyledButton = styled("div")` + cursor: pointer; + color: #ffffff; + background: #f2994a; + padding: 0px 10px; + height: 36px; + line-height: 36px; + border-radius: 4px; + display: flex; + align-items: center; + font-family: "Inter"; + font-size: 14px; + &:hover { + background: #d68742; + } +`; + export default SheetListMenu;