FIX: Replace SVG "X" icons with Lucide icons for consistency in dialogs

This commit is contained in:
Daniel
2024-12-22 14:51:50 +01:00
committed by Nicolás Hatcher Andrés
parent dbddc027fb
commit 8ba131011e
3 changed files with 45 additions and 71 deletions

View File

@@ -1,5 +1,5 @@
import styled from "@emotion/styled"; import styled from "@emotion/styled";
import { BookOpen, FileUp } from "lucide-react"; import { BookOpen, FileUp, X } from "lucide-react";
import { type DragEvent, useEffect, useRef, useState } from "react"; import { type DragEvent, useEffect, useRef, useState } from "react";
function UploadFileDialog(properties: { function UploadFileDialog(properties: {
@@ -113,30 +113,11 @@ function UploadFileDialog(properties: {
<Cross <Cross
style={{ marginRight: 12 }} style={{ marginRight: 12 }}
onClick={handleClose} onClick={handleClose}
title="Close Dialog"
ref={crossRef} ref={crossRef}
tabIndex={0} tabIndex={0}
> >
<svg <X />
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<title>Close</title>
<path
d="M12 4.5L4 12.5"
stroke="#333333"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M4 4.5L12 12.5"
stroke="#333333"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
</Cross> </Cross>
</UploadTitle> </UploadTitle>
{message === "" ? ( {message === "" ? (
@@ -237,6 +218,11 @@ const Cross = styled("div")`
cursor: pointer; cursor: pointer;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
svg {
width: 16px;
height: 16px;
stroke-width: 1.5;
}
`; `;
const DocLink = styled("span")` const DocLink = styled("span")`

View File

@@ -1,5 +1,6 @@
import { Dialog, TextField, styled } from "@mui/material"; import { Dialog, TextField, styled } from "@mui/material";
import { useState } from "react"; import { Check, X } from "lucide-react";
import { useRef, useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { theme } from "../../theme"; import { theme } from "../../theme";
@@ -13,6 +14,7 @@ interface SheetRenameDialogProps {
const SheetRenameDialog = (properties: SheetRenameDialogProps) => { const SheetRenameDialog = (properties: SheetRenameDialogProps) => {
const { t } = useTranslation(); const { t } = useTranslation();
const [name, setName] = useState(properties.defaultName); const [name, setName] = useState(properties.defaultName);
const crossRef = useRef<HTMLDivElement>(null);
const handleClose = () => { const handleClose = () => {
properties.onClose(); properties.onClose();
}; };
@@ -20,28 +22,14 @@ const SheetRenameDialog = (properties: SheetRenameDialogProps) => {
<Dialog open={properties.open} onClose={properties.onClose}> <Dialog open={properties.open} onClose={properties.onClose}>
<StyledDialogTitle> <StyledDialogTitle>
{t("sheet_rename.title")} {t("sheet_rename.title")}
<Cross onClick={handleClose} onKeyDown={() => {}}> <Cross
<svg onClick={handleClose}
width="16" title="Close Dialog"
height="16" ref={crossRef}
viewBox="0 0 16 16" tabIndex={0}
fill="none" onKeyDown={() => {}}
xmlns="http://www.w3.org/2000/svg"
> >
<title>Close</title> <X />
<path
d="M12 4.5L4 12.5"
stroke="#333333"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M4 4.5L12 12.5"
stroke="#333333"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
</Cross> </Cross>
</StyledDialogTitle> </StyledDialogTitle>
<StyledDialogContent> <StyledDialogContent>
@@ -73,6 +61,9 @@ const SheetRenameDialog = (properties: SheetRenameDialogProps) => {
properties.onNameChanged(name); properties.onNameChanged(name);
}} }}
> >
<Check
style={{ width: "16px", height: "16px", marginRight: "8px" }}
/>
{t("sheet_rename.rename")} {t("sheet_rename.rename")}
</StyledButton> </StyledButton>
</DialogFooter> </DialogFooter>
@@ -94,7 +85,7 @@ const StyledDialogTitle = styled("div")`
const Cross = styled("div")` const Cross = styled("div")`
&:hover { &:hover {
background-color: ${theme.palette.grey["100"]}; background-color: ${theme.palette.grey["50"]};
} }
display: flex; display: flex;
border-radius: 4px; border-radius: 4px;
@@ -103,6 +94,11 @@ const Cross = styled("div")`
cursor: pointer; cursor: pointer;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
svg {
width: 16px;
height: 16px;
stroke-width: 1.5;
}
`; `;
const StyledDialogContent = styled("div")` const StyledDialogContent = styled("div")`

View File

@@ -1,7 +1,7 @@
import styled from "@emotion/styled"; import styled from "@emotion/styled";
import { Dialog, TextField } from "@mui/material"; import { Dialog, TextField } from "@mui/material";
import { Check } from "lucide-react"; import { Check, X } from "lucide-react";
import { useState } from "react"; import { useRef, useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { theme } from "../theme"; import { theme } from "../theme";
@@ -17,6 +17,7 @@ type FormatPickerProps = {
const FormatPicker = (properties: FormatPickerProps) => { const FormatPicker = (properties: FormatPickerProps) => {
const { t } = useTranslation(); const { t } = useTranslation();
const [formatCode, setFormatCode] = useState(properties.numFmt); const [formatCode, setFormatCode] = useState(properties.numFmt);
const crossRef = useRef<HTMLDivElement>(null);
const handleClose = () => { const handleClose = () => {
properties.onClose(); properties.onClose();
@@ -36,28 +37,14 @@ const FormatPicker = (properties: FormatPickerProps) => {
> >
<StyledDialogTitle> <StyledDialogTitle>
{t("num_fmt.title")} {t("num_fmt.title")}
<Cross onClick={handleClose} onKeyDown={() => {}}> <Cross
<svg onClick={handleClose}
width="16" title="Close Dialog"
height="16" ref={crossRef}
viewBox="0 0 16 16" tabIndex={0}
fill="none" onKeyDown={() => {}}
xmlns="http://www.w3.org/2000/svg"
> >
<title>Close</title> <X />
<path
d="M12 4.5L4 12.5"
stroke="#333333"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M4 4.5L12 12.5"
stroke="#333333"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
</Cross> </Cross>
</StyledDialogTitle> </StyledDialogTitle>
@@ -101,7 +88,7 @@ const StyledDialogTitle = styled("div")`
const Cross = styled("div")` const Cross = styled("div")`
&:hover { &:hover {
background-color: ${theme.palette.grey["100"]}; background-color: ${theme.palette.grey["50"]};
} }
display: flex; display: flex;
border-radius: 4px; border-radius: 4px;
@@ -110,6 +97,11 @@ const Cross = styled("div")`
cursor: pointer; cursor: pointer;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
svg {
width: 16px;
height: 16px;
stroke-width: 1.5;
}
`; `;
const StyledDialogContent = styled("div")` const StyledDialogContent = styled("div")`