ente/web/packages/base/components/mui/DialogCloseIconButton.tsx
Manav Rathi 5a755d851a
Move
2025-02-14 17:12:17 +05:30

23 lines
767 B
TypeScript

import type { ModalVisibilityProps } from "@/base/components/utils/modal";
import CloseIcon from "@mui/icons-material/Close";
import { IconButton } from "@mui/material";
import { t } from "i18next";
import React from "react";
type DialogCloseIconButtonProps = Omit<ModalVisibilityProps, "open">;
/**
* 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<DialogCloseIconButtonProps> = ({
onClose,
}) => (
<IconButton aria-label={t("close")} color="secondary" onClick={onClose}>
<CloseIcon />
</IconButton>
);