omni-tools/src/components/result/ResultFooter.tsx

43 lines
1.0 KiB
TypeScript
Raw Normal View History

2024-06-25 01:10:41 +01:00
import { Stack } from '@mui/material';
import Button from '@mui/material/Button';
import DownloadIcon from '@mui/icons-material/Download';
import ContentPasteIcon from '@mui/icons-material/ContentPaste';
import React from 'react';
2025-07-12 23:02:35 -07:00
import { useTranslation } from 'react-i18next';
2024-06-25 01:10:41 +01:00
export default function ResultFooter({
handleDownload,
handleCopy,
2025-04-03 20:04:25 +00:00
disabled,
2025-07-07 02:29:20 +01:00
hideCopy,
2025-07-12 23:02:35 -07:00
downloadLabel
2024-06-25 01:10:41 +01:00
}: {
handleDownload: () => void;
2025-07-07 02:29:20 +01:00
handleCopy?: () => void;
2024-06-25 01:10:41 +01:00
disabled?: boolean;
2025-04-03 20:04:25 +00:00
hideCopy?: boolean;
2025-07-07 02:29:20 +01:00
downloadLabel?: string;
2024-06-25 01:10:41 +01:00
}) {
2025-07-12 23:02:35 -07:00
const { t } = useTranslation();
2024-06-25 01:10:41 +01:00
return (
<Stack mt={1} direction={'row'} spacing={2}>
<Button
disabled={disabled}
onClick={handleDownload}
startIcon={<DownloadIcon />}
>
2025-07-12 23:02:35 -07:00
{downloadLabel || t('resultFooter.download')}
2024-06-25 01:10:41 +01:00
</Button>
2025-04-03 20:04:25 +00:00
{!hideCopy && (
<Button
disabled={disabled}
onClick={handleCopy}
startIcon={<ContentPasteIcon />}
>
2025-07-12 23:02:35 -07:00
{t('resultFooter.copy')}
2025-04-03 20:04:25 +00:00
</Button>
)}
2024-06-25 01:10:41 +01:00
</Stack>
);
}