Skip to content

Commit

Permalink
fix: Grid layout
Browse files Browse the repository at this point in the history
  • Loading branch information
can-keklik committed Jul 21, 2024
1 parent 9264396 commit fce57eb
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lykiadb-playground/app/editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const EditorView = () => {
padding={10}
style={{
fontFamily: '"Fira code", "Fira Mono", monospace',
fontSize: 12,
fontSize: 16,
}}
/>
);
Expand Down
4 changes: 2 additions & 2 deletions lykiadb-playground/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import "./globals.css";
const inter = Inter({ subsets: ["latin"] });

export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
title: "LykiaDB Playground",
description: "A simple Next.js app to play with LykiaDB",
};

export default function RootLayout({
Expand Down
31 changes: 28 additions & 3 deletions lykiadb-playground/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,38 @@
'use client';

import dynamic from 'next/dynamic';
import GridLayout from "react-grid-layout";
import 'react-grid-layout/css/styles.css';

const EditorView = dynamic(() => import('./editor'), {
ssr: false,
});


// layout is an array of objects, see the demo for more complete usage
const layout = [
{ i: "a", x: 0, y: 0, w: 6, h: 12, isResizable: true, resizeHandles: ['se'] },
{ i: "b", x: 6, y: 0, w: 3, h: 6, isResizable: true, resizeHandles: ['se'] },
{ i: "c", x: 6, y: 0, w: 3, h: 6, isResizable: true, resizeHandles: ['se'] }
];

export default function Home() {
return (
<main className="flex min-h-screen flex-col items-center justify-between p-24">
<EditorView />
<main className="min-h-screen p-6">

<GridLayout
className="layout"
layout={layout}
cols={12}
rowHeight={30}
width={1200}
>
<div className="bg-white p-3 rounded-md" key="a">
<EditorView />
</div>
<div className="bg-white p-3 rounded-md" key="b">b</div>
<div className="bg-white p-3 rounded-md" key="c">c</div>
</GridLayout>
</main>
);
}
}
1 change: 1 addition & 0 deletions lykiadb-playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"prismjs": "^1.29.0",
"react": "^18",
"react-dom": "^18",
"react-grid-layout": "^1.4.4",
"react-simple-code-editor": "^0.14.1"
},
"devDependencies": {
Expand Down
64 changes: 61 additions & 3 deletions lykiadb-playground/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fce57eb

Please sign in to comment.