diff --git a/web/apps/photos/src/components/Upload/UploadTypeSelector.tsx b/web/apps/photos/src/components/Upload/UploadTypeSelector.tsx index bc57535eeb..0a055764ec 100644 --- a/web/apps/photos/src/components/Upload/UploadTypeSelector.tsx +++ b/web/apps/photos/src/components/Upload/UploadTypeSelector.tsx @@ -1,12 +1,12 @@ import { useIsTouchscreen } from "@/base/hooks"; import { FocusVisibleButton } from "@/new/photos/components/FocusVisibleButton"; import { SpaceBetweenFlex } from "@/new/photos/components/mui"; +import { DialogCloseIconButton } from "@/new/photos/components/mui/Dialog"; import DialogTitleWithCloseButton, { dialogCloseHandler, } from "@ente/shared/components/DialogBox/TitleWithCloseButton"; import { EnteMenuItem } from "@ente/shared/components/Menu/EnteMenuItem"; import ChevronRight from "@mui/icons-material/ChevronRight"; -import CloseIcon from "@mui/icons-material/Close"; import GoogleIcon from "@mui/icons-material/Google"; import { default as FileUploadIcon } from "@mui/icons-material/ImageOutlined"; import { default as FolderUploadIcon } from "@mui/icons-material/PermMediaOutlined"; @@ -14,7 +14,6 @@ import { Box, Dialog, DialogTitle, - IconButton, Link, Stack, Typography, @@ -222,13 +221,7 @@ const TakeoutOptions: React.FC> = ({ <> {t("google_takeout")} - - - + diff --git a/web/packages/new/photos/components/CollectionMappingChoiceDialog.tsx b/web/packages/new/photos/components/CollectionMappingChoiceDialog.tsx index 2240fc9a40..8902f1affc 100644 --- a/web/packages/new/photos/components/CollectionMappingChoiceDialog.tsx +++ b/web/packages/new/photos/components/CollectionMappingChoiceDialog.tsx @@ -1,19 +1,18 @@ import type { CollectionMapping } from "@/base/types/ipc"; import { FocusVisibleButton } from "@/new/photos/components/FocusVisibleButton"; -import CloseIcon from "@mui/icons-material/Close"; import FolderIcon from "@mui/icons-material/Folder"; import FolderCopyIcon from "@mui/icons-material/FolderCopy"; import { Dialog, DialogContent, DialogTitle, - IconButton, Stack, Typography, } from "@mui/material"; import { t } from "i18next"; import React from "react"; -import { SpaceBetweenFlex, type DialogVisiblityProps } from "./mui"; +import { SpaceBetweenFlex } from "./mui"; +import { DialogCloseIconButton, type DialogVisiblityProps } from "./mui/Dialog"; type CollectionMappingChoiceModalProps = DialogVisiblityProps & { didSelect: (mapping: CollectionMapping) => void; @@ -35,14 +34,9 @@ export const CollectionMappingChoiceDialog: React.FC< > {t("multi_folder_upload")} - - - + + void; +} + +type DialogCloseIconButtonProps = Omit; + +/** + * A convenience {@link IconButton} commonly needed on {@link Dialog}s, at the + * top right, to allow the user to close the dialog. + * + * Note that an explicit "Cancel" button is a better approach whenever possible, + * so use this sparingly. + */ +export const DialogCloseIconButton: React.FC = ({ + onClose, +}) => ( + + + +); diff --git a/web/packages/new/photos/components/mui/index.tsx b/web/packages/new/photos/components/mui/index.tsx index 3e16719cda..bb88e71bb0 100644 --- a/web/packages/new/photos/components/mui/index.tsx +++ b/web/packages/new/photos/components/mui/index.tsx @@ -1,15 +1,5 @@ import { Box, IconButton, styled } from "@mui/material"; -/** - * Common props to control the display of a dialog-like component. - */ -export interface DialogVisiblityProps { - /** If `true`, the dialog is shown. */ - open: boolean; - /** Callback fired when the dialog wants to be closed. */ - onClose: () => void; -} - /** * A MUI {@link IconButton} filled in with at faint background. */