Added tabs.json

This commit is contained in:
MrFry 2020-03-08 12:16:14 +01:00
parent b7dcc360bc
commit 8a1149d223
5 changed files with 39 additions and 40 deletions

View file

@ -1,5 +1,7 @@
import Link from 'next/link'
import tabs from '../data/tabs.json'
// TODO: activelink prop to set link to active
export default function Layout (props) {
const { currPageName } = props
@ -17,26 +19,16 @@ export default function Layout (props) {
Frylabs
</div>
</div>
<Link href='/' >
<a
className={currPageName === 'index' ? 'active' : ''}
>home</a>
</Link>
<Link href='/manual' >
<a
className={currPageName === 'manual' ? 'active' : ''}
>manual</a>
</Link>
<Link href='/allQuestions' >
<a
className={currPageName === 'allQuestions' ? 'active' : ''}
>AllQuestions</a>
</Link>
<Link href='/userQuestions' >
<a
className={currPageName === 'userQuestions' ? 'active' : ''}
>userQuestions</a>
</Link>
{Object.keys(tabs).map((key) => {
const item = tabs[key]
return (
<Link href={item.href} key={key} >
<a
className={currPageName === key ? 'active' : ''}
>{item.text}</a>
</Link>
)
})}
</div>
<div className='content'>
{props.children}