192debd829
* add finalize action to Desktop UI * Update LayerUI.tsx * add size to panel component * finzalize button style * add finalize button * changed isMobile to DeviceInfo, added isTouchScreen * cleanup * rename deviceInfo to deviceType * rename deviceInfo to deviceType * added updateObject * Update App.tsx
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import { useState } from "react";
|
|
import { t } from "../i18n";
|
|
import { useDeviceType } from "./App";
|
|
import { trash } from "./icons";
|
|
import { ToolButton } from "./ToolButton";
|
|
|
|
import ConfirmDialog from "./ConfirmDialog";
|
|
|
|
const ClearCanvas = ({ onConfirm }: { onConfirm: () => void }) => {
|
|
const [showDialog, setShowDialog] = useState(false);
|
|
const toggleDialog = () => {
|
|
setShowDialog(!showDialog);
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<ToolButton
|
|
type="button"
|
|
icon={trash}
|
|
title={t("buttons.clearReset")}
|
|
aria-label={t("buttons.clearReset")}
|
|
showAriaLabel={useDeviceType().isMobile}
|
|
onClick={toggleDialog}
|
|
data-testid="clear-canvas-button"
|
|
/>
|
|
|
|
{showDialog && (
|
|
<ConfirmDialog
|
|
onConfirm={() => {
|
|
onConfirm();
|
|
toggleDialog();
|
|
}}
|
|
onCancel={toggleDialog}
|
|
title={t("clearCanvasDialog.title")}
|
|
>
|
|
<p className="clear-canvas__content"> {t("alerts.clearReset")}</p>
|
|
</ConfirmDialog>
|
|
)}
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default ClearCanvas;
|