Skip to content

Commit

Permalink
poc: resizable panels
Browse files Browse the repository at this point in the history
  • Loading branch information
andresgnlez committed Oct 24, 2024
1 parent da9f3fb commit 84aa786
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 60 deletions.
41 changes: 10 additions & 31 deletions client/src/app/(projects)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"use client";

import { useMap } from "react-map-gl";

import { motion } from "framer-motion";
import { useAtomValue } from "jotai";

Expand All @@ -13,22 +11,11 @@ import ProjectsHeader from "@/containers/projects/header";
import ProjectsMap from "@/containers/projects/map";
import ProjectsTable from "@/containers/projects/table-visualization";

import {
ResizableHandle,
ResizablePanel,
ResizablePanelGroup,
} from "@/components/ui/resizable";
import { useSidebar } from "@/components/ui/sidebar";

export default function Projects() {
const { filtersOpen } = useAtomValue(projectsUIState);
const { open: navOpen } = useSidebar();
const { default: map } = useMap();

const onResizeMapPanel = () => {
if (!map) return;
map.resize();
};

return (
<motion.div
Expand All @@ -54,25 +41,17 @@ export default function Projects() {
>
<ProjectsFilters />
</motion.aside>
<ResizablePanelGroup
className="flex flex-1 flex-col overflow-hidden"
direction="vertical"
>
<div className="flex flex-1 flex-col">
<ProjectsHeader />
{/*<div className="grid flex-grow grid-rows-2 gap-3">*/}
<ResizablePanel
className="flex-1"
onResize={onResizeMapPanel}
minSize={25}
>
<ProjectsMap />
</ResizablePanel>
<ResizableHandle withHandle className="my-5" />
<ResizablePanel className="flex-1" minSize={25}>
<ProjectsTable />
</ResizablePanel>
{/*</div>*/}
</ResizablePanelGroup>
<div className="grid flex-grow grid-rows-2 gap-3">
<section className="flex-1">
<ProjectsMap />
</section>
<section className="flex-1">
<ProjectsTable />
</section>
</div>
</div>
</motion.div>
);
}
41 changes: 12 additions & 29 deletions pnpm-lock.yaml

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

0 comments on commit 84aa786

Please sign in to comment.