Skip to content

Commit

Permalink
fix sidebar desktop ui and remove close sidebar button on desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
vmork committed Nov 17, 2024
1 parent 92a0149 commit 0ead226
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/app/student/map/_components/MainView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export default function MainView({
filteredBooths={filteredBooths}
setFilteredBooths={setFilteredBooths}
/>
<div className="h-[calc(100dvh-144px)] flex-grow">
<div className="h-[calc(100dvh-144px)] sm:h-full flex-grow">
<MapComponent
initialView={initialView}
boothsById={currentLocationBoothsById}
Expand Down
20 changes: 6 additions & 14 deletions src/app/student/map/_components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"
import { cn } from "@/lib/utils"
import {
ArrowLeft,
ChevronsLeft,
ChevronsRight,
EraserIcon,
FilterIcon,
MapIcon,
Expand Down Expand Up @@ -135,7 +133,6 @@ export default function Sidebar({
onClick={() => setActiveDrawerBoothId(null)}>
<ArrowLeft size={30} className="stroke-stone-400" />
</Button>

<div className="flex justify-end py-2">
<Button
className="flex gap-2"
Expand Down Expand Up @@ -342,22 +339,17 @@ function SidebarContainer({
)
}

// Sidebar is always open on desktop
return (
<div className={cn("relative h-full", open ? "w-[500px]" : "w-0")}>
<div className={cn("relative h-full w-[500px] overflow-hidden")}>
<DrawerHeader>
<Dialog>{header}</Dialog>
</DrawerHeader>

<ScrollArea className="h-full">
{children}
<ScrollBar></ScrollBar>
</ScrollArea>

<div className="absolute right-[-38px] top-0 z-20">
<Button
variant="ghost"
className="rounded-s-none border-none p-1"
onClick={() => setOpen(!open)}
title={open ? "Close sidebar" : "Open sidebar"}>
{open ? <ChevronsLeft size={30} /> : <ChevronsRight size={30} />}
</Button>
</div>
</div>
)
}

0 comments on commit 0ead226

Please sign in to comment.