From dcc99acdb1bce38e80b0c0baf4effd822d02194c Mon Sep 17 00:00:00 2001 From: Philipp Mandler Date: Fri, 3 May 2024 14:42:46 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20Sticky=20TopBar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes #359 --- frontend/src/common/top_bar.tsx | 25 ++++++++++++++++++++++++- frontend/src/pages/document.tsx | 2 +- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/frontend/src/common/top_bar.tsx b/frontend/src/common/top_bar.tsx index 0458f33e..de40f78f 100644 --- a/frontend/src/common/top_bar.tsx +++ b/frontend/src/common/top_bar.tsx @@ -1,4 +1,6 @@ +import clsx from 'clsx'; import { useLocation } from 'wouter'; + import { storeAuthToken } from '../api'; import { logout } from '../api/user'; import { primitiveWithClassname } from '../styled'; @@ -8,7 +10,28 @@ import { Popup } from '../components/popup'; import { showModal } from '../components/modal'; import { ChangePasswordModal } from '../components/change_password'; import { useAuthData } from '../utils/auth'; -export const TopBar = primitiveWithClassname('div', 'mb-8 flex items-center gap-4 justify-between'); + +const TopBarBg = primitiveWithClassname( + 'div', + 'fixed left-0 right-0 top-0 bg-black h-[52px] -z-10 bg-white dark:bg-neutral-900', +); + +export function TopBar({ children, className }: { children: React.ReactNode; className?: string }) { + return ( +
+ + {children} +
+ ); +} export const TopBarTitle = primitiveWithClassname('h2', 'text-xl font-bold'); export const TopBarPart = primitiveWithClassname('div', 'gap-4 flex items-center'); diff --git a/frontend/src/pages/document.tsx b/frontend/src/pages/document.tsx index 1ed18558..97dfb359 100644 --- a/frontend/src/pages/document.tsx +++ b/frontend/src/pages/document.tsx @@ -136,7 +136,7 @@ export function DocumentPage({ {data?.name} - + {isLoggedIn && (