feat: Add dynamic sticky positioning to PageHeader based on mode

Following SubmenuBar pattern, PageHeader now adapts its sticky
position based on fullscreen mode.

Changes:
1. PageHeader Component
   - Added fullscreen prop (boolean)
   - Dynamic top position calculation
   - Fullscreen: top-0 (submenu at top-0)
   - WP-Admin: top-[calc(7rem+32px)] = 144px (below WP bar + menu)

2. App.tsx
   - Pass fullscreen={true} in fullscreen modes
   - Pass fullscreen={false} in WP-Admin mode
   - Matches SubmenuBar prop pattern

Logic (matches SubmenuBar):
const topClass = fullscreen ? 'top-0' : 'top-[calc(7rem+32px)]';

Layout Positions:
┌─────────────────────────────────────┐
│ Fullscreen Mode:                    │
│   SubmenuBar: top-0                 │
│   PageHeader: top-0               │
├─────────────────────────────────────┤
│ WP-Admin Mode:                      │
│   SubmenuBar: top-[calc(7rem+32px)] │
│   PageHeader: top-[calc(7rem+32px)] │
└─────────────────────────────────────┘

Result:
 PageHeader sticks correctly in fullscreen
 PageHeader sticks correctly in WP-Admin
 Consistent with SubmenuBar behavior
 No overlap or covering issues

Files Modified:
- PageHeader.tsx: Added fullscreen prop + dynamic positioning
- App.tsx: Pass fullscreen prop to all PageHeader instances
This commit is contained in:
dwindown
2025-11-06 15:39:39 +07:00
parent 2ec76c7dec
commit c3d4fbd794
2 changed files with 14 additions and 5 deletions

View File

@@ -422,7 +422,7 @@ function Shell() {
) : (
<SubmenuBar items={main.children} fullscreen={true} />
)}
<PageHeader />
<PageHeader fullscreen={true} />
<div className="flex-1 overflow-auto p-4">
<AppRoutes />
</div>
@@ -437,7 +437,7 @@ function Shell() {
<SubmenuBar items={main.children} fullscreen={true} />
)}
<main className="flex-1 flex flex-col min-h-0">
<PageHeader />
<PageHeader fullscreen={true} />
<div className="flex-1 overflow-auto p-4">
<AppRoutes />
</div>
@@ -452,7 +452,7 @@ function Shell() {
) : (
<SubmenuBar items={main.children} fullscreen={false} />
)}
<PageHeader />
<PageHeader fullscreen={false} />
<main className="flex-1 flex flex-col min-h-0">
<div className="flex-1 overflow-auto p-4">
<AppRoutes />