Browse Source

fixed imwald header overwriting page header

imwald
Silberengel 4 months ago
parent
commit
eceb3bfa28
  1. 12
      src/PageManager.tsx
  2. 61
      src/layouts/SecondaryPageLayout/index.tsx

12
src/PageManager.tsx

@ -353,6 +353,11 @@ function MainContentArea({
{primaryNoteView ? ( {primaryNoteView ? (
// Show note view with back button // Show note view with back button
<div className="flex flex-col h-full w-full"> <div className="flex flex-col h-full w-full">
<div className="flex justify-center py-1 border-b">
<span className="text-green-600 dark:text-green-500 font-semibold text-sm">
Imwald
</span>
</div>
<div className="flex gap-1 p-1 items-center justify-between font-semibold border-b"> <div className="flex gap-1 p-1 items-center justify-between font-semibold border-b">
<div className="flex items-center flex-1 w-0"> <div className="flex items-center flex-1 w-0">
<Button <Button
@ -369,7 +374,7 @@ function MainContentArea({
</Button> </Button>
</div> </div>
<div className="flex-1 flex justify-center"> <div className="flex-1 flex justify-center">
<div className="text-lg font-semibold text-green-500"> <div className="text-lg font-semibold">
{getPageTitle(primaryViewType, window.location.pathname)} {getPageTitle(primaryViewType, window.location.pathname)}
</div> </div>
</div> </div>
@ -732,6 +737,11 @@ export function PageManager({ maxStackSize = 5 }: { maxStackSize?: number }) {
{primaryNoteView ? ( {primaryNoteView ? (
// Show primary note view with back button on mobile // Show primary note view with back button on mobile
<div className="flex flex-col h-full w-full"> <div className="flex flex-col h-full w-full">
<div className="flex justify-center py-1 border-b">
<span className="text-green-600 dark:text-green-500 font-semibold text-sm">
Imwald
</span>
</div>
<div className="flex gap-1 p-1 items-center justify-between font-semibold border-b"> <div className="flex gap-1 p-1 items-center justify-between font-semibold border-b">
<div className="flex items-center flex-1 w-0"> <div className="flex items-center flex-1 w-0">
<Button <Button

61
src/layouts/SecondaryPageLayout/index.tsx

@ -66,13 +66,20 @@ const SecondaryPageLayout = forwardRef(
}} }}
> >
{title && ( {title && (
<SecondaryPageTitlebar <>
title={title} <div className="flex justify-center py-1 border-b">
controls={controls} <span className="text-green-600 dark:text-green-500 font-semibold text-sm">
hideBackButton={hideBackButton} Imwald
hideBottomBorder={hideTitlebarBottomBorder} </span>
titlebar={titlebar} </div>
/> <SecondaryPageTitlebar
title={title}
controls={controls}
hideBackButton={hideBackButton}
hideBottomBorder={hideTitlebarBottomBorder}
titlebar={titlebar}
/>
</>
)} )}
{children} {children}
</div> </div>
@ -85,13 +92,20 @@ const SecondaryPageLayout = forwardRef(
<DeepBrowsingProvider active={currentIndex === index} scrollAreaRef={scrollAreaRef}> <DeepBrowsingProvider active={currentIndex === index} scrollAreaRef={scrollAreaRef}>
<div className="h-full flex flex-col"> <div className="h-full flex flex-col">
{title && ( {title && (
<SecondaryPageTitlebar <>
title={title} <div className="flex justify-center py-1 border-b">
controls={controls} <span className="text-green-600 dark:text-green-500 font-semibold text-sm">
hideBackButton={hideBackButton} Imwald
hideBottomBorder={hideTitlebarBottomBorder} </span>
titlebar={titlebar} </div>
/> <SecondaryPageTitlebar
title={title}
controls={controls}
hideBackButton={hideBackButton}
hideBottomBorder={hideTitlebarBottomBorder}
titlebar={titlebar}
/>
</>
)} )}
<div className="flex-1" ref={scrollAreaRef}> <div className="flex-1" ref={scrollAreaRef}>
{children} {children}
@ -119,8 +133,6 @@ export function SecondaryPageTitlebar({
hideBottomBorder?: boolean hideBottomBorder?: boolean
titlebar?: React.ReactNode titlebar?: React.ReactNode
}): JSX.Element { }): JSX.Element {
const { isSmallScreen } = useScreenSize()
if (titlebar) { if (titlebar) {
return ( return (
<Titlebar className="p-1" hideBottomBorder={hideBottomBorder}> <Titlebar className="p-1" hideBottomBorder={hideBottomBorder}>
@ -136,29 +148,12 @@ export function SecondaryPageTitlebar({
{hideBackButton ? ( {hideBackButton ? (
<div className="flex gap-2 items-center pl-3 w-fit truncate text-lg font-semibold"> <div className="flex gap-2 items-center pl-3 w-fit truncate text-lg font-semibold">
{title} {title}
<span className="text-green-600 dark:text-green-500 font-semibold text-sm ml-2">
Im Wald 🌲
</span>
</div> </div>
) : ( ) : (
<div className="flex items-center flex-1 w-0"> <div className="flex items-center flex-1 w-0">
<BackButton>{title}</BackButton> <BackButton>{title}</BackButton>
</div> </div>
)} )}
{isSmallScreen && (
<div className="absolute left-1/2 transform -translate-x-1/2 z-10">
<span className="text-green-600 dark:text-green-500 font-semibold text-sm">
Im Wald 🌲
</span>
</div>
)}
{!isSmallScreen && !hideBackButton && (
<div className="absolute left-1/2 transform -translate-x-1/2 z-10 pointer-events-none">
<span className="text-green-600 dark:text-green-500 font-semibold text-sm">
Im Wald 🌲
</span>
</div>
)}
<div className="flex-shrink-0">{controls}</div> <div className="flex-shrink-0">{controls}</div>
</Titlebar> </Titlebar>
) )

Loading…
Cancel
Save