-
Notifications
You must be signed in to change notification settings - Fork 0
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 #10 from Vizzuality/SS-49-logo-collapsable-sidebar
Display the navigation
- Loading branch information
Showing
29 changed files
with
1,238 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
"use client"; | ||
|
||
import React from "react"; | ||
|
||
import { mediaStyles } from "@/media"; | ||
|
||
function RootHead() { | ||
return ( | ||
// eslint-disable-next-line @next/next/no-head-element | ||
<head> | ||
<style key="fresnel-css" dangerouslySetInnerHTML={{ __html: mediaStyles }} type="text/css" /> | ||
</head> | ||
); | ||
} | ||
|
||
export default RootHead; |
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,21 @@ | ||
export interface IntroProps { | ||
showDescription?: boolean; | ||
} | ||
|
||
const Intro = ({ showDescription = true }: IntroProps) => { | ||
return ( | ||
<div className="text-center xl:text-left"> | ||
<h1 className="font-serif text-4xl text-supernova-yellow-400 xl:text-[46px] xl:leading-[63px]"> | ||
South Sudan | ||
</h1> | ||
{showDescription && ( | ||
<p className="mx-auto mt-0.5 max-w-[280px] text-xs xl:mt-4 xl:max-w-none xl:text-sm"> | ||
Introduction lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor | ||
sit amet, consectetu elit. | ||
</p> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default Intro; |
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,21 @@ | ||
"use client"; | ||
|
||
import { Media, MediaContextProvider } from "@/media"; | ||
|
||
import NavigationDesktop from "./navigation-desktop"; | ||
import NavigationMobile from "./navigation-mobile"; | ||
|
||
const Navigation = () => { | ||
return ( | ||
<MediaContextProvider> | ||
<Media lessThan="xl"> | ||
<NavigationMobile /> | ||
</Media> | ||
<Media greaterThanOrEqual="xl" className="absolute"> | ||
<NavigationDesktop /> | ||
</Media> | ||
</MediaContextProvider> | ||
); | ||
}; | ||
|
||
export default Navigation; |
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,21 @@ | ||
import { cn } from "@/lib/utils"; | ||
|
||
import { useSidebar } from "../ui/sidebar"; | ||
|
||
const Logo = () => { | ||
const { state } = useSidebar(); | ||
|
||
return ( | ||
<div | ||
className={cn({ | ||
"absolute left-10 top-6 z-20 w-[200px] text-[15px] font-semibold leading-[18px] text-white transition-all duration-500 ease-out": | ||
true, | ||
"translate-x-6 text-rhino-blue-950": state === "collapsed", | ||
})} | ||
> | ||
Hydrological Information Management Systems | ||
</div> | ||
); | ||
}; | ||
|
||
export default Logo; |
28 changes: 28 additions & 0 deletions
28
client/src/components/navigation/navigation-desktop/index.tsx
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,28 @@ | ||
"use client"; | ||
|
||
import Intro from "@/components/intro"; | ||
import MainPanel from "@/components/panels/main"; | ||
import { Sidebar, SidebarContent, SidebarHeader, SidebarTrigger } from "@/components/ui/sidebar"; | ||
|
||
import Logo from "../logo"; | ||
|
||
const NavigationDesktop = () => { | ||
return ( | ||
<> | ||
<Logo /> | ||
<Sidebar> | ||
<SidebarHeader className="h-[88px] bg-rhino-blue-900 px-10 py-6 text-white"> | ||
<SidebarTrigger className="absolute right-0 top-6 z-10 translate-x-1/2 transition-transform group-data-[state=collapsed]:translate-x-full [&_svg]:rotate-90 group-data-[state=collapsed]:[&_svg]:-rotate-90" /> | ||
</SidebarHeader> | ||
<SidebarContent className="overflow-auto"> | ||
<div className="bg-rhino-blue-900 px-10 pb-6 text-white"> | ||
<Intro /> | ||
</div> | ||
<MainPanel /> | ||
</SidebarContent> | ||
</Sidebar> | ||
</> | ||
); | ||
}; | ||
|
||
export default NavigationDesktop; |
23 changes: 23 additions & 0 deletions
23
client/src/components/navigation/navigation-mobile/constants.ts
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,23 @@ | ||
import ChartBarIcon from "@/svgs/chart-bar.svg"; | ||
import MapPinIcon from "@/svgs/map-pin.svg"; | ||
import MapIcon from "@/svgs/map.svg"; | ||
|
||
import { Tab } from "./types"; | ||
|
||
export const TABS: Record< | ||
Tab, | ||
{ name: string; icon: React.ForwardRefExoticComponent<React.SVGProps<SVGSVGElement>> } | ||
> = { | ||
location: { | ||
name: "Location", | ||
icon: MapPinIcon, | ||
}, | ||
main: { | ||
name: "Analysis", | ||
icon: ChartBarIcon, | ||
}, | ||
map: { | ||
name: "Map", | ||
icon: MapIcon, | ||
}, | ||
}; |
56 changes: 56 additions & 0 deletions
56
client/src/components/navigation/navigation-mobile/index.tsx
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,56 @@ | ||
"use client"; | ||
|
||
import { useState } from "react"; | ||
|
||
import Intro from "@/components/intro"; | ||
import LocationPanel from "@/components/panels/location"; | ||
import MainPanel from "@/components/panels/main"; | ||
import { Button } from "@/components/ui/button"; | ||
import { Sheet, SheetContent, SheetHeader, SheetOverlay, SheetTitle } from "@/components/ui/sheet"; | ||
|
||
import { TABS } from "./constants"; | ||
import { Tab } from "./types"; | ||
|
||
const NavigationMobile = () => { | ||
const [tab, setTab] = useState<Tab>(Tab.Main); | ||
|
||
return ( | ||
<> | ||
<Sheet modal={false} open={tab === Tab.Main || tab === Tab.Location}> | ||
<SheetOverlay className="!bottom-[68px]" /> | ||
<SheetContent side="bottom" className="bottom-[68px] h-[calc(100%_-_68px)]"> | ||
<SheetHeader className="text-center"> | ||
<SheetTitle className="sr-only">{TABS[tab].name}</SheetTitle> | ||
<Intro showDescription={tab === Tab.Main} /> | ||
</SheetHeader> | ||
<div className="mt-6"> | ||
{tab === Tab.Main && <MainPanel />} | ||
{tab === Tab.Location && <LocationPanel />} | ||
</div> | ||
</SheetContent> | ||
</Sheet> | ||
<div | ||
role="menubar" | ||
className="relative z-20 flex items-center justify-center bg-rhino-blue-900 px-5 py-2.5 text-white" | ||
> | ||
{Object.entries(TABS).map(([key, { name, icon: Icon }]) => ( | ||
<Button | ||
key={key} | ||
variant="ghost" | ||
size="auto" | ||
type="button" | ||
role="menuitemradio" | ||
aria-checked={key === tab} | ||
className="w-16 flex-col items-center aria-checked:text-supernova-yellow-400" | ||
onClick={() => setTab(key as Tab)} | ||
> | ||
<Icon className="shrink-0" aria-hidden /> | ||
<span className="text-xs">{name}</span> | ||
</Button> | ||
))} | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default NavigationMobile; |
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,5 @@ | ||
export enum Tab { | ||
Main = "main", | ||
Location = "location", | ||
Map = "map", | ||
} |
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,5 @@ | ||
const LocationPanel = () => { | ||
return <div className="py-11 text-center font-semibold">Coming soon!</div>; | ||
}; | ||
|
||
export default LocationPanel; |
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,5 @@ | ||
const MainPanel = () => { | ||
return <div className="py-11 text-center font-semibold">Coming soon!</div>; | ||
}; | ||
|
||
export default MainPanel; |
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
Oops, something went wrong.