Skip to content

Commit f51470f

Browse files
committed
feat: move admin top navbar to sidebar
1 parent 759146d commit f51470f

1 file changed

Lines changed: 38 additions & 12 deletions

File tree

components/AdminLayout.js

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import Link from 'next/link'
33
import { useRouter, withRouter } from 'next/router'
44
import clsx from 'clsx'
55
import { BiServer } from 'react-icons/bi'
6-
import { MdOutlineGroups, MdOutlineExitToApp } from 'react-icons/md'
6+
import { MdOutlineGroups, MdOutlineExitToApp, MdOutlineNotifications, MdLogout, MdSettings } from 'react-icons/md'
77
import { AiOutlineLayout } from 'react-icons/ai'
8+
import Avatar from './Avatar'
89
import Loader from './Loader'
910
import ErrorLayout from './ErrorLayout'
1011
import Nav from './Nav'
@@ -62,7 +63,7 @@ const AdminLayout = ({ children, title }) => {
6263
<main className='h-screen overflow-hidden relative'>
6364
<div className='flex items-start justify-between'>
6465
<div className='h-screen hidden lg:block shadow-lg relative w-80'>
65-
<div className='h-full bg-primary-900'>
66+
<div className='h-full bg-primary-900 flex flex-col'>
6667
<div className='pt-6 ml-8'>
6768
<div className='font-bold text-xl flex w-full'>
6869
<span className='mx-4'>
@@ -73,8 +74,8 @@ const AdminLayout = ({ children, title }) => {
7374
</Link>
7475
</div>
7576
</div>
76-
<nav className='mt-6'>
77-
<div>
77+
<nav className='mt-6 h-screen flex flex-col justify-between'>
78+
<div className='h-full'>
7879
{left.map(({ href, name, label }) => {
7980
const className = clsx('hover:text-accent-200 flex transition-colors text-gray-100 text-xl p-2 my-4', {
8081
'border-l-4 border-accent-500': router.asPath === href
@@ -99,18 +100,43 @@ const AdminLayout = ({ children, title }) => {
99100
)
100101
})}
101102
</div>
103+
<div className='h-1/5 flex flex-col'>
104+
<div className='flex-grow'>
105+
<div className='flex px-4'>
106+
<Link href={`/player/${user.id}`}>
107+
<a className='flex'>
108+
<Avatar width='36' height='36' uuid={user.id} />
109+
<div className='ml-4 text-sm'>
110+
<div>{user.name}</div>
111+
<div>View Profile</div>
112+
</div>
113+
</a>
114+
</Link>
115+
</div>
116+
</div>
117+
<div className='flex justify-evenly py-3 bg-gray-800'>
118+
<Link href='/notifications'>
119+
<a title='Notifications'>
120+
<MdOutlineNotifications className='w-6 h-6' />
121+
</a>
122+
</Link>
123+
<Link href='/account'>
124+
<a title='Settings'>
125+
<MdSettings className='w-6 h-6' />
126+
</a>
127+
</Link>
128+
<Link href='/dashboard'>
129+
<a title='Return'>
130+
<MdLogout className='w-6 h-6' />
131+
</a>
132+
</Link>
133+
</div>
134+
</div>
102135
</nav>
103136
</div>
104137
</div>
105138
<div className='flex flex-col w-full md:space-y-4'>
106-
<header className='w-full h-24 z-40 hidden md:flex items-center justify-between bg-primary-900 border-b border-gray-800'>
107-
<div className='z-20 flex flex-col justify-end h-full p-3 md:w-full'>
108-
<div className='p-1 flex items-center w-full space-x-4 justify-end top-4'>
109-
<SessionNavProfile key='session-nav-profile' user={user} />
110-
</div>
111-
</div>
112-
</header>
113-
<div className='overflow-auto h-screen pb-24 px-4 md:px-6'>
139+
<div className='overflow-auto h-screen pb-24 pt-4 px-4 md:px-6'>
114140
{children}
115141
</div>
116142
</div>

0 commit comments

Comments
 (0)