feat: add changing appearance for guests (#2632)
* Allow changing appearance when guest * Apply suggestions from code review Co-authored-by: Tom Moor <tom.moor@gmail.com>
This commit is contained in:
@ -4,7 +4,9 @@ import {
|
|||||||
TableOfContentsIcon,
|
TableOfContentsIcon,
|
||||||
EditIcon,
|
EditIcon,
|
||||||
PlusIcon,
|
PlusIcon,
|
||||||
|
MoonIcon,
|
||||||
MoreIcon,
|
MoreIcon,
|
||||||
|
SunIcon,
|
||||||
} from "outline-icons";
|
} from "outline-icons";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@ -70,6 +72,7 @@ function DocumentHeader({
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const team = useCurrentTeam();
|
const team = useCurrentTeam();
|
||||||
const { ui, policies } = useStores();
|
const { ui, policies } = useStores();
|
||||||
|
const { resolvedTheme } = ui;
|
||||||
const isMobile = useMobile();
|
const isMobile = useMobile();
|
||||||
|
|
||||||
const handleSave = React.useCallback(() => {
|
const handleSave = React.useCallback(() => {
|
||||||
@ -125,6 +128,27 @@ function DocumentHeader({
|
|||||||
</Action>
|
</Action>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const appearanceAction = (
|
||||||
|
<Action>
|
||||||
|
<Tooltip
|
||||||
|
tooltip={
|
||||||
|
resolvedTheme === "light" ? t("Switch to dark") : t("Switch to light")
|
||||||
|
}
|
||||||
|
delay={500}
|
||||||
|
placement="bottom"
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
icon={resolvedTheme === "light" ? <SunIcon /> : <MoonIcon />}
|
||||||
|
onClick={() =>
|
||||||
|
ui.setTheme(resolvedTheme === "light" ? "dark" : "light")
|
||||||
|
}
|
||||||
|
neutral
|
||||||
|
borderOnHover
|
||||||
|
/>
|
||||||
|
</Tooltip>
|
||||||
|
</Action>
|
||||||
|
);
|
||||||
|
|
||||||
if (shareId) {
|
if (shareId) {
|
||||||
return (
|
return (
|
||||||
<Header
|
<Header
|
||||||
@ -138,7 +162,12 @@ function DocumentHeader({
|
|||||||
{toc}
|
{toc}
|
||||||
</PublicBreadcrumb>
|
</PublicBreadcrumb>
|
||||||
}
|
}
|
||||||
actions={canEdit ? editAction : <div />}
|
actions={
|
||||||
|
<>
|
||||||
|
{appearanceAction}
|
||||||
|
{canEdit ? editAction : <div />}
|
||||||
|
</>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user