mirror of
https://github.com/outline/outline.git
synced 2026-11-21 21:44:30 +03:00
* chore: More public share cleanup * fix: Use correct amount of spaces for tab * fix: Pointer on public shares * fix: Tweak AAA contrast * Show code language on public share
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import { observer } from "mobx-react";
|
|
import * as React from "react";
|
|
import { ThemeProvider } from "styled-components";
|
|
import GlobalStyles from "@shared/styles/globals";
|
|
import { TeamPreference, UserPreference } from "@shared/types";
|
|
import useBuildTheme from "~/hooks/useBuildTheme";
|
|
import useStores from "~/hooks/useStores";
|
|
|
|
type Props = {
|
|
children?: React.ReactNode;
|
|
};
|
|
|
|
const Theme: React.FC = ({ children }: Props) => {
|
|
const { auth, ui } = useStores();
|
|
const theme = useBuildTheme(
|
|
auth.team?.getPreference(TeamPreference.CustomTheme) ||
|
|
auth.config?.customTheme ||
|
|
undefined
|
|
);
|
|
|
|
React.useEffect(() => {
|
|
window.dispatchEvent(
|
|
new CustomEvent("theme-changed", {
|
|
detail: { isDark: ui.resolvedTheme === "dark" },
|
|
})
|
|
);
|
|
}, [ui.resolvedTheme]);
|
|
|
|
return (
|
|
<ThemeProvider theme={theme}>
|
|
<>
|
|
<GlobalStyles
|
|
useCursorPointer={
|
|
// Default to showing the cursor pointer if no user is logged in (public share)
|
|
auth.user?.getPreference(UserPreference.UseCursorPointer) ?? true
|
|
}
|
|
/>
|
|
{children}
|
|
</>
|
|
</ThemeProvider>
|
|
);
|
|
};
|
|
|
|
export default observer(Theme);
|