Skip to content
Snippets Groups Projects
Commit e7d4a209 authored by Chif Gergő's avatar Chif Gergő
Browse files

Add basic navbar

parent 6c1e1392
No related branches found
No related tags found
2 merge requests!7update master to dev,!4Feature/profile
import React from 'react';
import {
AppBar, Tab, Tabs, Toolbar,
} from '@material-ui/core';
import React, { useState } from 'react';
import { useHistory } from 'react-router';
const Header = () => <div>Header</div>;
interface AppBarMenuItem {
title: string;
redirectTo: string;
}
const MENU_ITEMS: AppBarMenuItem[] = [
{
title: 'Home',
redirectTo: '/',
},
{
title: 'News',
redirectTo: '/news',
},
];
const Header: React.FC = () => {
const [value, setValue] = useState(0);
const history = useHistory();
return (
<AppBar position="static">
<Toolbar>
<Tabs
value={value}
onChange={(event, val) => {
setValue(val);
}}
>
{MENU_ITEMS.map((item) => (
<Tab
label={item.title}
onClick={() => {
history.push(item.redirectTo);
}}
/>
))}
</Tabs>
</Toolbar>
</AppBar>
);
};
export default Header;
html,
body,
#root {
margin: 0;
height: 100%;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment