mirror of
https://github.com/docmost/docmost.git
synced 2026-05-17 06:44:05 +08:00
46 lines
1.0 KiB
TypeScript
46 lines
1.0 KiB
TypeScript
import { Group, Button, Tooltip } from "@mantine/core";
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
type BaseViewDraftBannerProps = {
|
|
isDirty: boolean;
|
|
canSave: boolean;
|
|
onReset: () => void;
|
|
onSave: () => void;
|
|
saving: boolean;
|
|
};
|
|
|
|
export function BaseViewDraftBanner({
|
|
isDirty,
|
|
canSave,
|
|
onReset,
|
|
onSave,
|
|
saving,
|
|
}: BaseViewDraftBannerProps) {
|
|
const { t } = useTranslation();
|
|
if (!isDirty) return null;
|
|
return (
|
|
<Group justify="flex-end" gap="xs" px="md" py={6} wrap="nowrap">
|
|
<Button variant="subtle" color="gray" size="xs" onClick={onReset}>
|
|
{t("Reset")}
|
|
</Button>
|
|
{canSave && (
|
|
<Tooltip
|
|
label={t("Filter and sort changes are visible only to you")}
|
|
position="bottom"
|
|
withArrow
|
|
>
|
|
<Button
|
|
variant="light"
|
|
color="orange"
|
|
size="xs"
|
|
onClick={onSave}
|
|
loading={saving}
|
|
>
|
|
{t("Save for everyone")}
|
|
</Button>
|
|
</Tooltip>
|
|
)}
|
|
</Group>
|
|
);
|
|
}
|