-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from reedu-reengineering-education/feat/shadcn…
…-drawer Feat/shadcn drawer
- Loading branch information
Showing
30 changed files
with
979 additions
and
499 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { TopBar } from '@/components/ui/TopBar' | ||
import '@/styles/globals.css' | ||
|
||
export default function RootLayout({ | ||
children, | ||
}: { | ||
children: React.ReactNode | ||
}) { | ||
return ( | ||
<div className="relative h-full w-full"> | ||
<main className="h-full w-full overflow-auto landscape:pl-safe"> | ||
{children} | ||
</main> | ||
<div className="absolute top-0 w-screen backdrop-blur pt-safe" /> | ||
<header className="absolute right-0 top-0 w-fit mt-safe"> | ||
<TopBar /> | ||
</header> | ||
</div> | ||
) | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
'use client' | ||
|
||
import { ArrowLeftIcon } from 'lucide-react' | ||
import Link from 'next/link' | ||
import { usePathname } from 'next/navigation' | ||
|
||
const titles: Record<string, string> = { | ||
'/': '', | ||
'/tracks': 'Tracks', | ||
} | ||
|
||
const Navbar = () => { | ||
const pathname = usePathname() | ||
|
||
const isHome = pathname === '/' | ||
|
||
return ( | ||
<div className="pointer-events-auto sticky top-0 z-10 flex w-full items-center justify-between border-b border-muted px-4 pb-4 pt-2 landscape:px-safe-or-4"> | ||
<div className="flex items-center gap-2"> | ||
{!isHome && ( | ||
<Link href="/"> | ||
<ArrowLeftIcon className="h-7 w-7" /> | ||
</Link> | ||
)} | ||
<h1 className="text-xl">{titles[pathname]}</h1> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export { Navbar } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
import TrackWrapper from '@/components/Tracks/track-wrapper' | ||
import { Navbar } from './navbar' | ||
|
||
export default function TracksPage() { | ||
return ( | ||
<div className="h-full w-full overflow-scroll p-4 pb-safe-or-4"> | ||
<TrackWrapper /> | ||
</div> | ||
<main className="h-full w-full p-safe"> | ||
<header> | ||
<Navbar /> | ||
</header> | ||
<div className="h-full w-full overflow-scroll p-4 pb-safe-or-4"> | ||
<TrackWrapper /> | ||
</div> | ||
</main> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,46 @@ | ||
'use client' | ||
|
||
import { useState } from 'react' | ||
import { Drawer } from 'vaul' | ||
import MeasurementsGrid from '../Map/MeasurementsGrid' | ||
import WizardDrawer from '../Wizard/WizardDrawer' | ||
import { Drawer, DrawerContent } from '../ui/drawer' | ||
import TrajectoryMap from './TrajectoryMap' | ||
|
||
export default function DeviceMapWrapper() { | ||
const [snap, setSnap] = useState(0.2) | ||
|
||
return ( | ||
<div className="flex h-full w-full portrait:flex-col"> | ||
<div className="relative h-full w-full"> | ||
<TrajectoryMap paddingBottom={snap} /> | ||
</div> | ||
<div className="portrait:border-b landscape:border-r-2"> | ||
<Drawer.Root | ||
open | ||
modal={false} | ||
dismissible={false} | ||
snapPoints={[0.2, 0.55]} | ||
activeSnapPoint={snap} | ||
setActiveSnapPoint={snap => { | ||
if (!snap) return | ||
if (typeof snap === 'string') { | ||
setSnap(parseFloat(snap)) | ||
} else if (snap < 0.2) { | ||
setSnap(0.2) | ||
} else { | ||
setSnap(snap) | ||
} | ||
}} | ||
> | ||
<Drawer.Portal> | ||
<Drawer.Content className="fixed bottom-0 left-0 right-0 z-30 flex h-full max-h-[95%] flex-col rounded-t-lg border-t bg-background pb-safe focus:outline-none"> | ||
<div | ||
className="mx-auto mb-2 mt-4 h-1.5 w-12 flex-shrink-0 rounded-full bg-muted" | ||
onClick={() => setSnap(0.55)} | ||
/> | ||
<> | ||
<div className="flex h-full w-full portrait:flex-col"> | ||
<div className="relative h-full w-full"> | ||
<TrajectoryMap paddingBottom={snap} /> | ||
</div> | ||
<div className="portrait:border-b landscape:border-r-2"> | ||
<Drawer | ||
open | ||
modal={false} | ||
dismissible={false} | ||
snapPoints={[0.2, 0.55]} | ||
activeSnapPoint={snap} | ||
shouldScaleBackground={false} | ||
setActiveSnapPoint={snap => { | ||
if (!snap) return | ||
if (typeof snap === 'string') { | ||
setSnap(parseFloat(snap)) | ||
} else if (snap < 0.2) { | ||
setSnap(0.2) | ||
} else { | ||
setSnap(snap) | ||
} | ||
}} | ||
> | ||
<DrawerContent className="h-full"> | ||
<MeasurementsGrid /> | ||
</Drawer.Content> | ||
</Drawer.Portal> | ||
</Drawer.Root> | ||
</DrawerContent> | ||
</Drawer> | ||
</div> | ||
</div> | ||
</div> | ||
<WizardDrawer /> | ||
</> | ||
) | ||
} |
Oops, something went wrong.