Extract out sidebaricon; link to /about
This commit is contained in:
parent
b9548b80f2
commit
d326ae5c30
|
@ -1,10 +1,8 @@
|
||||||
import {
|
import {
|
||||||
HomeIcon,
|
HomeIcon,
|
||||||
FireIcon,
|
|
||||||
UserGroupIcon,
|
UserGroupIcon,
|
||||||
TrendingUpIcon,
|
|
||||||
SearchIcon,
|
SearchIcon,
|
||||||
CollectionIcon,
|
BookOpenIcon,
|
||||||
} from '@heroicons/react/outline'
|
} from '@heroicons/react/outline'
|
||||||
import clsx from 'clsx'
|
import clsx from 'clsx'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
|
@ -13,11 +11,15 @@ import { useRouter } from 'next/router'
|
||||||
const navigation = [
|
const navigation = [
|
||||||
{ name: 'Home', href: '/home', icon: HomeIcon },
|
{ name: 'Home', href: '/home', icon: HomeIcon },
|
||||||
{ name: 'Markets', href: '/markets', icon: SearchIcon },
|
{ name: 'Markets', href: '/markets', icon: SearchIcon },
|
||||||
{ name: 'Communities', href: '/folds', icon: UserGroupIcon },
|
{ name: 'About', href: 'https://docs.manifold.markets', icon: BookOpenIcon },
|
||||||
{ name: 'Trades', href: '/trades', icon: CollectionIcon },
|
|
||||||
// { name: 'Trending', href: '#', icon: TrendingUpIcon, current: false },
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
type Item = {
|
||||||
|
name: string
|
||||||
|
href: string
|
||||||
|
icon: React.ComponentType<{ className?: string }>
|
||||||
|
}
|
||||||
|
|
||||||
const communities = [
|
const communities = [
|
||||||
{ name: 'Movies', href: '#' },
|
{ name: 'Movies', href: '#' },
|
||||||
{ name: 'Food', href: '#' },
|
{ name: 'Food', href: '#' },
|
||||||
|
@ -29,14 +31,9 @@ const communities = [
|
||||||
{ name: 'Gaming', href: '#' },
|
{ name: 'Gaming', href: '#' },
|
||||||
]
|
]
|
||||||
|
|
||||||
export default function Sidebar() {
|
function SidebarItem(props: { item: Item; currentPage: string }) {
|
||||||
const router = useRouter()
|
const { item, currentPage } = props
|
||||||
const currentPage = router.pathname
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<nav aria-label="Sidebar" className="sticky top-4 divide-y divide-gray-300">
|
|
||||||
<div className="space-y-1 pb-8">
|
|
||||||
{navigation.map((item) => (
|
|
||||||
<Link href={item.href} key={item.name}>
|
<Link href={item.href} key={item.name}>
|
||||||
<a
|
<a
|
||||||
key={item.name}
|
key={item.name}
|
||||||
|
@ -61,23 +58,34 @@ export default function Sidebar() {
|
||||||
<span className="truncate">{item.name}</span>
|
<span className="truncate">{item.name}</span>
|
||||||
</a>
|
</a>
|
||||||
</Link>
|
</Link>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function Sidebar() {
|
||||||
|
const router = useRouter()
|
||||||
|
const currentPage = router.pathname
|
||||||
|
|
||||||
|
return (
|
||||||
|
<nav aria-label="Sidebar" className="sticky top-4 divide-y divide-gray-300">
|
||||||
|
<div className="space-y-1 pb-8">
|
||||||
|
{navigation.map((item) => (
|
||||||
|
<SidebarItem item={item} currentPage={currentPage} />
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div className="pt-10">
|
<div className="pt-10">
|
||||||
<p
|
<SidebarItem
|
||||||
className="px-3 text-xs font-semibold uppercase tracking-wider text-gray-500"
|
item={{ name: 'Communities', href: '/folds', icon: UserGroupIcon }}
|
||||||
id="communities-headline"
|
currentPage={currentPage}
|
||||||
>
|
/>
|
||||||
My communities
|
|
||||||
</p>
|
<div className="mt-3 space-y-2">
|
||||||
<div className="mt-3 space-y-2" aria-labelledby="communities-headline">
|
|
||||||
{communities.map((community) => (
|
{communities.map((community) => (
|
||||||
<a
|
<a
|
||||||
key={community.name}
|
key={community.name}
|
||||||
href={community.href}
|
href={community.href}
|
||||||
className="group flex items-center rounded-md px-3 py-2 text-sm font-medium text-gray-600 hover:bg-gray-50 hover:text-gray-900"
|
className="group flex items-center rounded-md px-3 py-2 text-sm font-medium text-gray-600 hover:bg-gray-50 hover:text-gray-900"
|
||||||
>
|
>
|
||||||
<span className="truncate">{community.name}</span>
|
<span className="truncate"> {community.name}</span>
|
||||||
</a>
|
</a>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user