Remove the top navbar entirely

This commit is contained in:
Austin Chen 2022-03-30 10:59:41 -07:00
parent 9408e9473c
commit 66add707a0
4 changed files with 55 additions and 35 deletions

View File

@ -7,8 +7,9 @@ import { ENV_CONFIG } from '../../../common/envs/constants'
export function ManifoldLogo(props: { export function ManifoldLogo(props: {
className?: string className?: string
darkBackground?: boolean darkBackground?: boolean
hideText?: boolean
}) { }) {
const { darkBackground, className } = props const { darkBackground, className, hideText } = props
const user = useUser() const user = useUser()
@ -21,30 +22,32 @@ export function ManifoldLogo(props: {
width={45} width={45}
height={45} height={45}
/> />
{ENV_CONFIG.navbarLogoPath ? (
<img src={ENV_CONFIG.navbarLogoPath} width={245} height={45} /> {!hideText &&
) : ( (ENV_CONFIG.navbarLogoPath ? (
<> <img src={ENV_CONFIG.navbarLogoPath} width={245} height={45} />
<div ) : (
className={clsx( <>
'font-major-mono mt-1 text-lg lowercase sm:hidden', <div
darkBackground && 'text-white' className={clsx(
)} 'font-major-mono mt-1 text-lg lowercase sm:hidden',
> darkBackground && 'text-white'
Manifold )}
<br /> >
Markets Manifold
</div> <br />
<div Markets
className={clsx( </div>
'font-major-mono mt-1 hidden lowercase sm:flex sm:text-2xl md:whitespace-nowrap', <div
darkBackground && 'text-white' className={clsx(
)} 'font-major-mono mt-1 hidden lowercase sm:flex sm:text-2xl md:whitespace-nowrap',
> darkBackground && 'text-white'
Manifold Markets )}
</div> >
</> Manifold Markets
)} </div>
</>
))}
</a> </a>
</Link> </Link>
) )

View File

@ -13,6 +13,7 @@ import {
UserGroupIcon, UserGroupIcon,
} from '@heroicons/react/outline' } from '@heroicons/react/outline'
// Deprecated. TODO: Remove this entirely.
export function NavBar(props: { export function NavBar(props: {
darkBackground?: boolean darkBackground?: boolean
wide?: boolean wide?: boolean
@ -49,14 +50,17 @@ export function NavBar(props: {
</Row> </Row>
</Row> </Row>
</nav> </nav>
{user && <BottomNavBar user={user} />} <BottomNavBar />
</> </>
) )
} }
// From https://codepen.io/chris__sev/pen/QWGvYbL // From https://codepen.io/chris__sev/pen/QWGvYbL
function BottomNavBar(props: { user: User }) { export function BottomNavBar() {
const { user } = props const user = useUser()
if (!user) {
return null
}
return ( return (
<nav className="fixed inset-x-0 bottom-0 z-20 flex justify-between border-t-2 bg-white text-xs text-gray-700 md:hidden"> <nav className="fixed inset-x-0 bottom-0 z-20 flex justify-between border-t-2 bg-white text-xs text-gray-700 md:hidden">
<Link href="/home"> <Link href="/home">
@ -89,6 +93,7 @@ function BottomNavBar(props: { user: User }) {
</a> </a>
</Link> </Link>
{/* TODO: replace with a link to your own profile */}
<Link href="/trades"> <Link href="/trades">
<a <a
href="#" href="#"
@ -102,10 +107,10 @@ function BottomNavBar(props: { user: User }) {
) )
} }
function NavOptions(props: { export function NavOptions(props: {
user: User | null | undefined user: User | null | undefined
assertUser: 'signed-in' | 'signed-out' | undefined assertUser?: 'signed-in' | 'signed-out'
themeClasses: string themeClasses?: string
}) { }) {
const { user, assertUser, themeClasses } = props const { user, assertUser, themeClasses } = props
const showSignedIn = assertUser === 'signed-in' || !!user const showSignedIn = assertUser === 'signed-in' || !!user

View File

@ -10,6 +10,10 @@ import Link from 'next/link'
import { useRouter } from 'next/router' import { useRouter } from 'next/router'
import { useFollowedFolds } from '../../hooks/use-fold' import { useFollowedFolds } from '../../hooks/use-fold'
import { useUser } from '../../hooks/use-user' import { useUser } from '../../hooks/use-user'
import { Row } from '../layout/row'
import { Spacer } from '../layout/spacer'
import { ManifoldLogo } from './manifold-logo'
import { NavOptions } from './nav-bar'
const navigation = [ const navigation = [
{ name: 'Home', href: '/home', icon: HomeIcon }, { name: 'Home', href: '/home', icon: HomeIcon },
@ -64,10 +68,18 @@ export default function Sidebar() {
return ( return (
<nav aria-label="Sidebar" className="sticky top-4 divide-y divide-gray-300"> <nav aria-label="Sidebar" className="sticky top-4 divide-y divide-gray-300">
<div className="space-y-1 pb-8"> <div className="space-y-1 pb-8">
<ManifoldLogo hideText />
<Spacer h={4} />
{navigation.map((item) => ( {navigation.map((item) => (
<SidebarItem item={item} currentPage={currentPage} /> <SidebarItem item={item} currentPage={currentPage} />
))} ))}
</div> </div>
<Row className="items-center gap-6 py-6 sm:gap-8">
{(user || user === null) && <NavOptions user={user} />}
</Row>
<div className="pt-10"> <div className="pt-10">
<SidebarItem <SidebarItem
item={{ name: 'Communities', href: '/folds', icon: UserGroupIcon }} item={{ name: 'Communities', href: '/folds', icon: UserGroupIcon }}

View File

@ -1,5 +1,5 @@
import clsx from 'clsx' import clsx from 'clsx'
import { NavBar } from './nav/nav-bar' import { BottomNavBar } from './nav/nav-bar'
import Sidebar from './nav/sidebar' import Sidebar from './nav/sidebar'
export function Page(props: { export function Page(props: {
@ -13,8 +13,6 @@ export function Page(props: {
return ( return (
<div> <div>
<NavBar wide={wide} assertUser={assertUser} />
<div <div
className={clsx( className={clsx(
'mx-auto w-full pb-16 lg:grid lg:grid-cols-12 lg:gap-8 xl:max-w-7xl', 'mx-auto w-full pb-16 lg:grid lg:grid-cols-12 lg:gap-8 xl:max-w-7xl',
@ -27,7 +25,7 @@ export function Page(props: {
</div> </div>
<main <main
className={clsx( className={clsx(
'lg:col-span-9', 'mt-6 lg:col-span-9',
rightSidebar ? 'xl:col-span-7' : 'xl:col-span-8' rightSidebar ? 'xl:col-span-7' : 'xl:col-span-8'
)} )}
> >
@ -37,6 +35,8 @@ export function Page(props: {
<div className="sticky top-4 space-y-4">{rightSidebar}</div> <div className="sticky top-4 space-y-4">{rightSidebar}</div>
</aside> </aside>
</div> </div>
<BottomNavBar />
</div> </div>
) )
} }