Compare commits

...

2 Commits

Author SHA1 Message Date
Sinclair Chen
574bdd539a Fix top nav style on tablet 2022-09-21 13:05:20 -07:00
Sinclair Chen
294cc9b614 Fix nav style on tablet 2022-09-21 13:04:09 -07:00
3 changed files with 16 additions and 11 deletions

View File

@ -1,4 +1,7 @@
import { ClipboardIcon, HomeIcon } from '@heroicons/react/outline' import {
ClipboardIcon,
PresentationChartLineIcon,
} from '@heroicons/react/outline'
import { Item } from './sidebar-item' import { Item } from './sidebar-item'
import clsx from 'clsx' import clsx from 'clsx'
@ -8,9 +11,10 @@ import { useUser } from 'web/hooks/use-user'
import NotificationsIcon from '../notifications-icon' import NotificationsIcon from '../notifications-icon'
import router from 'next/router' import router from 'next/router'
import { userProfileItem } from './bottom-nav-bar' import { userProfileItem } from './bottom-nav-bar'
import Link from 'next/link'
const mobileGroupNavigation = [ const mobileGroupNavigation = [
{ name: 'Markets', key: 'markets', icon: HomeIcon }, { name: 'Markets', key: 'markets', icon: PresentationChartLineIcon },
{ name: 'Leaderboard', key: 'leaderboards', icon: TrophyIcon }, { name: 'Leaderboard', key: 'leaderboards', icon: TrophyIcon },
{ name: 'About', key: 'about', icon: ClipboardIcon }, { name: 'About', key: 'about', icon: ClipboardIcon },
] ]
@ -32,7 +36,7 @@ export function GroupNavBar(props: {
const user = useUser() const user = useUser()
return ( return (
<nav className="z-20 flex justify-between border-t-2 bg-white text-xs text-gray-700 lg:hidden"> <nav className="z-20 flex border-t-2 bg-white text-xs text-gray-700">
{mobileGroupNavigation.map((item) => ( {mobileGroupNavigation.map((item) => (
<NavBarItem <NavBarItem
key={item.name} key={item.name}
@ -72,23 +76,23 @@ function NavBarItem(props: {
currentPage: string currentPage: string
onClick: (key: string) => void onClick: (key: string) => void
}) { }) {
const { item, currentPage } = props const { item, currentPage, onClick } = props
const track = trackCallback( const track = trackCallback(
`group navbar: ${item.trackingEventName ?? item.name}` `group navbar: ${item.trackingEventName ?? item.name}`
) )
return ( return (
<button onClick={() => props.onClick(item.key ?? '#')}> <Link href={item.href ?? '#'}>
<a <a
className={clsx( className={clsx(
'block w-full py-1 px-3 text-center hover:bg-indigo-200 hover:text-indigo-700', 'block w-full py-1 px-3 text-center hover:bg-indigo-200 hover:text-indigo-700',
currentPage === item.key && 'bg-gray-200 text-indigo-700' currentPage === item.key && 'bg-gray-200 text-indigo-700'
)} )}
onClick={track} onClick={() => (onClick?.(item.key ?? '#'), track())}
> >
{item.icon && <item.icon className="my-1 mx-auto h-6 w-6" />} {item.icon && <item.icon className="my-1 mx-auto h-6 w-6" />}
{item.name} {item.name}
</a> </a>
</button> </Link>
) )
} }

View File

@ -1,4 +1,4 @@
import { ClipboardIcon, HomeIcon } from '@heroicons/react/outline' import { ClipboardIcon, PresentationChartLineIcon } from '@heroicons/react/outline'
import clsx from 'clsx' import clsx from 'clsx'
import { useUser } from 'web/hooks/use-user' import { useUser } from 'web/hooks/use-user'
import { ManifoldLogo } from './manifold-logo' import { ManifoldLogo } from './manifold-logo'
@ -14,7 +14,7 @@ import { Row } from '../layout/row'
import { Spacer } from '../layout/spacer' import { Spacer } from '../layout/spacer'
const groupNavigation = [ const groupNavigation = [
{ name: 'Markets', key: 'markets', icon: HomeIcon }, { name: 'Markets', key: 'markets', icon: PresentationChartLineIcon },
{ name: 'About', key: 'about', icon: ClipboardIcon }, { name: 'About', key: 'about', icon: ClipboardIcon },
{ name: 'Leaderboard', key: 'leaderboards', icon: TrophyIcon }, { name: 'Leaderboard', key: 'leaderboards', icon: TrophyIcon },
] ]

View File

@ -302,12 +302,13 @@ export function TopGroupNavBar(props: {
onClick: (key: string) => void onClick: (key: string) => void
}) { }) {
return ( return (
<header className="sticky top-0 z-50 w-full border-b border-gray-200 md:hidden lg:col-span-12"> <header className="sticky top-0 z-50 w-full border-b border-gray-200 lg:hidden lg:col-span-12">
<div className="flex items-center bg-white px-4"> <div className="flex items-center bg-white px-4">
<div className="flex-shrink-0"> <div className="flex-shrink-0">
<Link href="/"> <Link href="/">
<a className="text-indigo-700 hover:text-gray-500 "> <a className="text-indigo-700 hover:text-gray-500 ">
<ArrowLeftIcon className="h-5 w-5" aria-hidden="true" /> <ArrowLeftIcon className="h-5 w-5" aria-hidden />
<span className='sr-only'>Home</span>
</a> </a>
</Link> </Link>
</div> </div>