From 0ff41d06fac4a0efaed675ede022f2e18332ebf9 Mon Sep 17 00:00:00 2001 From: Philipinho <16838612+Philipinho@users.noreply.github.com> Date: Mon, 21 Apr 2025 16:01:45 +0100 Subject: [PATCH] WIP --- .../features/share/components/share-shell.tsx | 33 +++++++++++++++++-- .../share/components/share.module.css | 25 +++++++++----- apps/client/src/pages/share/shared-page.tsx | 2 +- 3 files changed, 47 insertions(+), 13 deletions(-) diff --git a/apps/client/src/features/share/components/share-shell.tsx b/apps/client/src/features/share/components/share-shell.tsx index 6e0d9aed..6ad57d43 100644 --- a/apps/client/src/features/share/components/share-shell.tsx +++ b/apps/client/src/features/share/components/share-shell.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { useState } from "react"; import { ActionIcon, Affix, @@ -29,6 +29,8 @@ import { } from "@/features/share/atoms/sidebar-atom.ts"; import { IconList } from "@tabler/icons-react"; 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); @@ -52,6 +54,22 @@ export default function ShareShell({ const { data } = useGetSharedPageTreeQuery(shareId); const readOnlyEditor = useAtomValue(readOnlyEditorAtom); + const [navbarOutside, setNavbarOutside] = useState(null); + const [asideOutside, setAsideOutside] = useState(null); + + useClickOutside( + () => { + if (mobileOpened) { + toggleMobile(); + } + if (mobileTocOpened) { + toggleTocMobile(); + } + }, + null, + [navbarOutside, asideOutside], + ); + return ( {data?.pageTree?.length > 1 && ( - + )} @@ -155,7 +177,12 @@ export default function ShareShell({ - +
{readOnlyEditor && ( diff --git a/apps/client/src/features/share/components/share.module.css b/apps/client/src/features/share/components/share.module.css index 5293df37..617768ff 100644 --- a/apps/client/src/features/share/components/share.module.css +++ b/apps/client/src/features/share/components/share.module.css @@ -1,13 +1,20 @@ .shareLinkText { - @mixin light { - border-bottom: 0.05em solid var(--mantine-color-dark-0); - } - @mixin dark { - border-bottom: 0.05em solid var(--mantine-color-dark-2); - } + @mixin light { + border-bottom: 0.05em solid var(--mantine-color-dark-0); + } + @mixin dark { + border-bottom: 0.05em solid var(--mantine-color-dark-2); + } } .treeNode { - text-decoration: none; - user-select: none; -} \ No newline at end of file + text-decoration: none; + user-select: none; +} + +.navbar, +.aside { + @media (max-width: $mantine-breakpoint-sm) { + width: 350px; + } +} diff --git a/apps/client/src/pages/share/shared-page.tsx b/apps/client/src/pages/share/shared-page.tsx index 76f80819..5e96b183 100644 --- a/apps/client/src/pages/share/shared-page.tsx +++ b/apps/client/src/pages/share/shared-page.tsx @@ -45,7 +45,7 @@ export default function SingleSharedPage() { {!data?.share.searchIndexing && } - +