mirror of
https://github.com/docmost/docmost.git
synced 2025-11-18 22:31:11 +10:00
WIP
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
import React from "react";
|
import React, { useState } from "react";
|
||||||
import {
|
import {
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
Affix,
|
Affix,
|
||||||
@ -29,6 +29,8 @@ import {
|
|||||||
} from "@/features/share/atoms/sidebar-atom.ts";
|
} from "@/features/share/atoms/sidebar-atom.ts";
|
||||||
import { IconList } from "@tabler/icons-react";
|
import { IconList } from "@tabler/icons-react";
|
||||||
import { useToggleToc } from "@/features/share/hooks/use-toggle-toc.ts";
|
import { useToggleToc } from "@/features/share/hooks/use-toggle-toc.ts";
|
||||||
|
import classes from "./share.module.css";
|
||||||
|
import { useClickOutside } from "@mantine/hooks";
|
||||||
|
|
||||||
const MemoizedSharedTree = React.memo(SharedTree);
|
const MemoizedSharedTree = React.memo(SharedTree);
|
||||||
|
|
||||||
@ -52,6 +54,22 @@ export default function ShareShell({
|
|||||||
const { data } = useGetSharedPageTreeQuery(shareId);
|
const { data } = useGetSharedPageTreeQuery(shareId);
|
||||||
const readOnlyEditor = useAtomValue(readOnlyEditorAtom);
|
const readOnlyEditor = useAtomValue(readOnlyEditorAtom);
|
||||||
|
|
||||||
|
const [navbarOutside, setNavbarOutside] = useState<HTMLElement | null>(null);
|
||||||
|
const [asideOutside, setAsideOutside] = useState<HTMLElement | null>(null);
|
||||||
|
|
||||||
|
useClickOutside(
|
||||||
|
() => {
|
||||||
|
if (mobileOpened) {
|
||||||
|
toggleMobile();
|
||||||
|
}
|
||||||
|
if (mobileTocOpened) {
|
||||||
|
toggleTocMobile();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
[navbarOutside, asideOutside],
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppShell
|
<AppShell
|
||||||
header={{ height: 48 }}
|
header={{ height: 48 }}
|
||||||
@ -135,7 +153,11 @@ export default function ShareShell({
|
|||||||
</AppShell.Header>
|
</AppShell.Header>
|
||||||
|
|
||||||
{data?.pageTree?.length > 1 && (
|
{data?.pageTree?.length > 1 && (
|
||||||
<AppShell.Navbar p="md">
|
<AppShell.Navbar
|
||||||
|
p="md"
|
||||||
|
className={classes.navbar}
|
||||||
|
ref={setNavbarOutside}
|
||||||
|
>
|
||||||
<MemoizedSharedTree sharedPageTree={data} />
|
<MemoizedSharedTree sharedPageTree={data} />
|
||||||
</AppShell.Navbar>
|
</AppShell.Navbar>
|
||||||
)}
|
)}
|
||||||
@ -155,7 +177,12 @@ export default function ShareShell({
|
|||||||
</Affix>
|
</Affix>
|
||||||
</AppShell.Main>
|
</AppShell.Main>
|
||||||
|
|
||||||
<AppShell.Aside p="md" withBorder={false}>
|
<AppShell.Aside
|
||||||
|
p="md"
|
||||||
|
withBorder={mobileTocOpened}
|
||||||
|
className={classes.aside}
|
||||||
|
ref={setAsideOutside}
|
||||||
|
>
|
||||||
<ScrollArea style={{ height: "80vh" }} scrollbarSize={5} type="scroll">
|
<ScrollArea style={{ height: "80vh" }} scrollbarSize={5} type="scroll">
|
||||||
<div style={{ paddingBottom: "50px" }}>
|
<div style={{ paddingBottom: "50px" }}>
|
||||||
{readOnlyEditor && (
|
{readOnlyEditor && (
|
||||||
|
|||||||
@ -11,3 +11,10 @@
|
|||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.navbar,
|
||||||
|
.aside {
|
||||||
|
@media (max-width: $mantine-breakpoint-sm) {
|
||||||
|
width: 350px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -45,7 +45,7 @@ export default function SingleSharedPage() {
|
|||||||
{!data?.share.searchIndexing && <meta name="robots" content="noindex" />}
|
{!data?.share.searchIndexing && <meta name="robots" content="noindex" />}
|
||||||
</Helmet>
|
</Helmet>
|
||||||
|
|
||||||
<Container size={900}>
|
<Container size={900} p={0}>
|
||||||
<ReadonlyPageEditor
|
<ReadonlyPageEditor
|
||||||
key={data.page.id}
|
key={data.page.id}
|
||||||
title={data.page.title}
|
title={data.page.title}
|
||||||
|
|||||||
Reference in New Issue
Block a user