Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
453c7ac
feat: setup nextjs example
isBatak Oct 18, 2025
66e84b9
feat: init persistence support for resizable panels for ssr
isBatak Oct 19, 2025
95f2e5b
feat: update panel layout handling to support new format with panel IDs
isBatak Oct 19, 2025
907947e
feat: add panel order attribute for improved layout management
isBatak Oct 19, 2025
67e15a2
feat: enhance persistence logic for panel layout with new data attrib…
isBatak Oct 19, 2025
8d5120d
feat: improve persistence logic by adding early return for null state
isBatak Oct 19, 2025
7907c0a
feat: update panel default sizes for improved layout consistency
isBatak Oct 19, 2025
d52f7f0
feat: rename PersistScript with PanelPersistScript and make it opt-in
isBatak Oct 22, 2025
ea6270a
feat: refactor panel order handling and improve serialization tests
isBatak Oct 22, 2025
650b309
feat: enhance panel order handling in load and save functions for bet…
isBatak Oct 22, 2025
fabff8f
feat: add playwright test for panel persist script
isBatak Oct 23, 2025
11e1f42
feat: add PanelPersistScript readme
isBatak Oct 23, 2025
599ff38
feat: add suppressHydrationWarning prop to Panel components and remov…
isBatak Oct 24, 2025
2ad53d4
feat: minify the script
isBatak Oct 24, 2025
2e1769f
feat: change import to type for PanelLayoutItem and SerializedPanelGr…
isBatak Oct 24, 2025
29613a8
feat: implement useIsSSR hook for server-side rendering detection
isBatak Oct 25, 2025
6020a9b
chore: update next
isBatak Oct 25, 2025
b1922f9
chore: serialization refactor
isBatak Oct 26, 2025
3b2a438
feat: order prop auto increment
isBatak Oct 26, 2025
a8a5bb7
chore: update test
isBatak Oct 26, 2025
2261a44
feat: move css vars to panelGroup for better performance
isBatak Oct 26, 2025
4bcae4c
feat: add orderIsFromProps to panel data structure and update related…
isBatak Nov 2, 2025
86d2763
feat: replace PanelPersistScript with PersistScript and update docume…
isBatak Nov 2, 2025
3a21cd0
feat: refactor panel size handling with CSS variable template and upd…
isBatak Nov 2, 2025
170b782
feat: streamline panel persistence logic and enhance CSS variable han…
isBatak Nov 2, 2025
d28f085
feat: remove suppressHydrationWarning from PanelGroupWithForwardedRef
isBatak Nov 2, 2025
6c2e55f
chore: update readme
isBatak Nov 2, 2025
f5b40ed
Merge pull request #1 from isBatak/ssr-persistence-script-optim-css-vars
isBatak Nov 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions examples/nextjs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# env files (can opt-in for committing if needed)
.env*

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
25 changes: 25 additions & 0 deletions examples/nextjs/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { dirname } from "path";
import { fileURLToPath } from "url";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const compat = new FlatCompat({
baseDirectory: __dirname,
});

const eslintConfig = [
...compat.extends("next/core-web-vitals", "next/typescript"),
{
ignores: [
"node_modules/**",
".next/**",
"out/**",
"build/**",
"next-env.d.ts",
],
},
];

export default eslintConfig;
9 changes: 9 additions & 0 deletions examples/nextjs/next.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { NextConfig } from "next";

const nextConfig: NextConfig = {
/* config options here */
ignoreBuildErrors: true,
optimizePackageImports: ["react-resizable-panels"],
};

export default nextConfig;
26 changes: 26 additions & 0 deletions examples/nextjs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "react-resizable-panels-nextjs",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev --turbopack",
"build": "next build --turbopack",
"start": "next start",
"lint": "eslint"
},
"dependencies": {
"react": "19.2.0",
"react-dom": "19.2.0",
"next": "16.0.0",
"react-resizable-panels": "workspace:*"
},
"devDependencies": {
"typescript": "^5",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"eslint": "^9",
"eslint-config-next": "16.0.0",
"@eslint/eslintrc": "^3"
}
}
1 change: 1 addition & 0 deletions examples/nextjs/public/file.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/nextjs/public/globe.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/nextjs/public/next.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/nextjs/public/vercel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/nextjs/public/window.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/nextjs/src/app/favicon.ico
Binary file not shown.
91 changes: 91 additions & 0 deletions examples/nextjs/src/app/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
:root {
--color-background-code: #050a15;
--color-background-default: #081120;
--color-brand: #dcadff;
--color-button-background: #2a3343;
--color-button-background-hover: #39414d;
--color-button-border: #18181a;
--color-code: #dcadff;
--color-default: #ffffff;
--color-dim: #91a0ba;
--color-horizontal-rule: #39414d;
--color-input: #ffffff;
--color-input-background: #18181a;
--color-input-border: #39414d;
--color-input-border-focused: #dcadff;
--color-link: #dcadff;
--color-panel-background: #192230;
--color-panel-background-alternate: #202124;
--color-resize-bar: #515b6a;
--color-resize-bar-active: #b1bdd0;
--color-resize-bar-hover: #515b6a;
--color-warning-background: #7400cc;

--color-scroll-thumb: #515b6a;
}

:root,
html,
body {
padding: 0;
margin: 0;
max-width: 100vw;
overflow-x: hidden;

background-color: var(--color-background-default);
color: var(--color-default);

font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}

* {
box-sizing: border-box;
line-height: 1.5em;
}

p {
margin: 0.5rem 0;
}

code {
color: var(--color-code);
background-color: var(--color-background-code);
font-family: monospace;
padding: 0 0.25em;
border-radius: 0.25em;
}

h1,
h2 {
font-weight: normal;
margin: 0.5rem 0;
}

a {
color: var(--color-link);
}

::-webkit-scrollbar {
width: 0.75rem;
height: 0.75rem;
background: transparent;
}

::-webkit-scrollbar-corner {
background: transparent;
}

::-webkit-scrollbar-track {
border-radius: 0.75rem;
background: transparent;
}

::-webkit-scrollbar-thumb {
border-radius: 0.75rem;
background: var(--color-scroll-thumb);
}

::-webkit-scrollbar-thumb:hover {
background: var(--color-resize-bar-hover);
}
33 changes: 33 additions & 0 deletions examples/nextjs/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";

const geistSans = Geist({
variable: "--font-geist-sans",
subsets: ["latin"],
});

const geistMono = Geist_Mono({
variable: "--font-geist-mono",
subsets: ["latin"],
});

export const metadata: Metadata = {
title: "React Resizable Panels - Next.js Example",
description:
"Nested resizable panels example using react-resizable-panels in Next.js",
};

export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body className={`${geistSans.variable} ${geistMono.variable}`}>
{children}
</body>
</html>
);
}
Loading
Loading