Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

feat(ui): add PageLayout, the standalone-page twin of TabGroupLayout

Juan Denis761b4f0eba04
diff --git a/frontend/src/layouts/PageLayout.jsx b/frontend/src/layouts/PageLayout.jsx
new file mode 100644
index 00000000..85b1a386
--- /dev/null
+++ b/frontend/src/layouts/PageLayout.jsx
@@ -0,0 +1,55 @@
+import { cn } from '@/lib/utils';
+import { PageTopbar } from '@/components/ds';
+
+// Shell for a STANDALONE page — one that owns its whole route rather than
+// living inside a PageTopbar tab group. It is the exact same frame
+// TabGroupLayout gives a group (see layouts/TabGroupLayout.jsx): the top bar
+// pins flush to the top of the content region edge-to-edge, and the body
+// scrolls beneath it, centered at the reading max-width.
+//
+// <PageLayout icon={<Clock size={18} />} title="Cron Jobs" actions={…}>
+// …page body…
+// </PageLayout>
+//
+// Rendering a PageTopbar inside the default padded `.page-container` instead
+// (what every standalone page used to do by hand) leaves the bar floating in
+// the middle of the content well with a gutter on every side — it carries the
+// sidebar's surface and a bottom border precisely because it is meant to be
+// chrome pinned to the frame, not the first row of the page body.
+//
+// `fill` hands the body the whole region to manage its own scrolling (log
+// consoles, file trees, terminals); the default centers and pads it.
+export default function PageLayout({
+ icon,
+ title,
+ meta,
+ tabs,
+ navLabel,
+ actions,
+ fill = false,
+ className,
+ topbarClassName,
+ contentClassName,
+ children,
+}) {
+ return (
+ <div className={cn('page-container page-container--full-bleed sk-page', className)}>
+ <PageTopbar
+ className={topbarClassName}
+ icon={icon}
+ title={title}
+ meta={meta}
+ tabs={tabs}
+ navLabel={navLabel}
+ actions={actions}
+ />
+ <div className="sk-page__content">
+ {fill ? (
+ <div className={cn('sk-page__fill', contentClassName)}>{children}</div>
+ ) : (
+ <div className={cn('sk-page__inner', contentClassName)}>{children}</div>
+ )}
+ </div>
+ </div>
+ );
+}
diff --git a/frontend/src/styles/layout/_main-content.scss b/frontend/src/styles/layout/_main-content.scss
index 4df89011..bea6c6b6 100644
--- a/frontend/src/styles/layout/_main-content.scss
+++ b/frontend/src/styles/layout/_main-content.scss
@@ -77,12 +77,17 @@
}
}
-// Tab group shell (Servers / Domains-style route groups). A parent layout
-// renders the PageTopbar + routed sub-nav once (see layouts/ServersLayout.jsx)
-// and swaps only the content below, so switching tabs feels like real tabs
-// instead of a full-page remount. The shell is full-bleed so the header pins
-// to the very top and never shifts between tabs.
-.sk-tabgroup {
+// ============================================================
+// PAGE SHELL
+// The one frame every page gets, in two flavours:
+// .sk-page — a standalone page (layouts/PageLayout.jsx)
+// .sk-tabgroup — a routed tab group (layouts/TabGroupLayout.jsx)
+// Both are full-bleed so the top bar pins flush to the top of the content
+// region and the body scrolls beneath it. A page should never hand-roll this:
+// dropping a `.sk-topbar` into the default padded `.page-container` leaves the
+// bar floating in the well with a gutter on every side.
+// ============================================================
+@mixin page-shell {
height: 100%;
min-height: 0;
display: flex;
@@ -95,14 +100,54 @@
// Match the 18px header icon the per-page top bars used to render.
.sk-topbar__ico svg { width: 18px; height: 18px; }
+
+ @media (max-width: $breakpoint-md) { padding: 10px $space-3; }
+ }
+}
+
+// Scroll region below the bar.
+@mixin page-shell-content {
+ flex: 1;
+ min-height: 0;
+ display: flex;
+ flex-direction: column;
+ overflow-y: auto;
+}
+
+// Centered body: the reading column every ordinary page sits in.
+@mixin page-shell-inner {
+ width: 100%;
+ max-width: 1400px;
+ margin-inline: auto;
+ padding: $space-6 $space-6 $space-10;
+
+ @media (max-width: $breakpoint-md) { padding: $space-4 $space-4 $space-8; }
+}
+
+// Standalone pages (Cron Jobs, Settings, Documentation, …).
+.sk-page {
+ @include page-shell;
+
+ &__content {
+ @include page-shell-content;
+
+ // `fill` bodies (terminals, consoles, trees) take the whole region and
+ // manage their own scroll instead of riding the centered column.
+ > .sk-page__fill { flex: 1; min-height: 0; }
}
+ &__inner { @include page-shell-inner; }
+}
+
+// Tab group shell (Servers / Domains-style route groups). A parent layout
+// renders the PageTopbar + routed sub-nav once and swaps only the content
+// below, so switching tabs feels like real tabs instead of a full-page
+// remount — and the header never shifts between tabs.
+.sk-tabgroup {
+ @include page-shell;
+
&__content {
- flex: 1;
- min-height: 0;
- display: flex;
- flex-direction: column;
- overflow-y: auto;
+ @include page-shell-content;
// Full-bleed pages (File Manager) fill the region edge-to-edge and
// manage their own internal scroll. Centered pages instead wrap their
@@ -113,18 +158,7 @@
// Centered pages (Agent Fleet, Fleet Monitor, Cloud Servers, Config
// Templates) keep their max-width framing inside the full-bleed shell.
- &__inner {
- width: 100%;
- max-width: 1400px;
- margin-inline: auto;
- padding: $space-6 $space-6 $space-10;
- }
-
- @media (max-width: $breakpoint-md) {
- > .sk-topbar { padding: 10px $space-3; }
-
- &__inner { padding: $space-4 $space-4 $space-8; }
- }
+ &__inner { @include page-shell-inner; }
}
// REMOVED: `.page-header` (the old <div class="page-header"><h1>…</h1></div>