Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add resizeable panels #68

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
"npm-run-all": "^4.1.5",
"postcss": "^8",
"prettier": "^3.3.3",
"react-resizable-panels": "^2.1.2",
"tailwindcss": "^3.4.4",
"typescript": "^5.5.3",
"typescript-eslint": "^8.3.0",
Expand Down
52 changes: 33 additions & 19 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { tools } from "./lib/tools";
import { Editor } from "./components/editor";
import { ToolSelector } from "./components/tool-selector";
import { ThemeProvider } from "./components/theme-provider";
import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";

function App() {
const { language, tool, code, setCode } = useExplorer();
Expand All @@ -15,26 +16,39 @@ function App() {
<div className="flex flex-col h-screen">
<Navbar />
<div className="h-full overflow-hidden">
<div className="grid sm:grid-cols-2 divide-x border-t h-full">
<Editor
value={code[language]}
onChange={value => {
setCode({ ...code, [language]: value });
}}
/>
<div className="bg-muted overflow-auto h-[70dvh] sm:h-full relative flex flex-col">
<div className="flex sm:items-center flex-col sm:flex-row justify-between p-4 gap-2 z-10">
<ToolSelector />
<div className="flex items-center gap-1">
{activeTool.options.map(
(Option, index) => (
<Option key={index} />
),
)}
<div className="border-t h-full">
<PanelGroup
direction="horizontal"
className="border-t h-full"
>
<Panel defaultSize={50} minSize={25}>
<Editor
value={code[language]}
onChange={value => {
setCode({
...code,
[language]: value,
});
}}
/>
</Panel>
<PanelResizeHandle className="w-2 bg-gutter dark:bg-gray-600 bg-gray-200 bg-no-repeat bg-center" />
<Panel defaultSize={50} minSize={25}>
<div className="bg-muted overflow-auto h-[70dvh] sm:h-full relative flex flex-col">
<div className="flex sm:items-center flex-col sm:flex-row justify-between p-4 gap-2 z-10">
<ToolSelector />
<div className="flex items-center gap-1">
{activeTool.options.map(
(Option, index) => (
<Option key={index} />
),
)}
</div>
</div>
<activeTool.component />
</div>
</div>
<activeTool.component />
</div>
</Panel>
</PanelGroup>
</div>
</div>
</div>
Expand Down
Binary file added src/assets/gutter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion src/logo.svg

This file was deleted.

6 changes: 6 additions & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ module.exports = {
"accordion-down": "accordion-down 0.2s ease-out",
"accordion-up": "accordion-up 0.2s ease-out",
},
backgroundImage: {
gutter: "url('./assets/gutter.png')",
},
backgroundPosition: {
center: "50%",
},
},
},
plugins: [
Expand Down