mirror of
https://github.com/docmost/docmost.git
synced 2026-05-07 06:23:06 +08:00
refactor(base): simplify draft banner to inline Reset/Save controls
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
import { Paper, Group, Text, Button } from "@mantine/core";
|
import { Group, Button, Tooltip } from "@mantine/core";
|
||||||
import { IconInfoCircle } from "@tabler/icons-react";
|
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
type BaseViewDraftBannerProps = {
|
type BaseViewDraftBannerProps = {
|
||||||
@@ -20,25 +19,27 @@ export function BaseViewDraftBanner({
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
if (!isDirty) return null;
|
if (!isDirty) return null;
|
||||||
return (
|
return (
|
||||||
<Paper withBorder radius="sm" px="md" py="xs" bg="yellow.0">
|
<Group justify="flex-end" gap="xs" px="md" py={6} wrap="nowrap">
|
||||||
<Group justify="space-between" wrap="nowrap">
|
<Button variant="subtle" color="gray" size="xs" onClick={onReset}>
|
||||||
<Group gap="xs" wrap="nowrap">
|
{t("Reset")}
|
||||||
<IconInfoCircle size={16} />
|
</Button>
|
||||||
<Text size="sm">
|
{canSave && (
|
||||||
{t("Filter and sort changes are visible only to you.")}
|
<Tooltip
|
||||||
</Text>
|
label={t("Filter and sort changes are visible only to you")}
|
||||||
</Group>
|
position="bottom"
|
||||||
<Group gap="sm" wrap="nowrap">
|
withArrow
|
||||||
<Button variant="subtle" color="gray" size="xs" onClick={onReset}>
|
>
|
||||||
{t("Reset")}
|
<Button
|
||||||
|
variant="light"
|
||||||
|
color="orange"
|
||||||
|
size="xs"
|
||||||
|
onClick={onSave}
|
||||||
|
loading={saving}
|
||||||
|
>
|
||||||
|
{t("Save for everyone")}
|
||||||
</Button>
|
</Button>
|
||||||
{canSave && (
|
</Tooltip>
|
||||||
<Button size="xs" onClick={onSave} loading={saving}>
|
)}
|
||||||
{t("Save for everyone")}
|
</Group>
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</Paper>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user