umami/components/Header.js

30 lines
880 B
JavaScript
Raw Normal View History

2020-07-24 04:56:55 +02:00
import React from 'react';
2020-08-05 07:45:05 +02:00
import { useSelector } from 'react-redux';
import classNames from 'classnames';
import Link from 'components/Link';
2020-08-06 08:03:07 +02:00
import UserButton from './UserButton';
2020-08-05 07:45:05 +02:00
import styles from './Header.module.css';
2020-07-24 04:56:55 +02:00
export default function Header() {
2020-08-05 07:45:05 +02:00
const user = useSelector(state => state.user);
2020-07-24 04:56:55 +02:00
return (
2020-08-05 07:45:05 +02:00
<header className={classNames(styles.header, 'container')}>
<div className="row align-items-center">
<div className="col">
2020-08-06 08:03:07 +02:00
<div className={styles.title}>{user ? <Link href="/">umami</Link> : 'umami'}</div>
2020-08-05 07:45:05 +02:00
</div>
{user && (
<div className="col">
<div className={styles.nav}>
2020-08-06 08:03:07 +02:00
<Link href="/dashboard">Dashboard</Link>
2020-08-05 07:45:05 +02:00
<Link href="/settings">Settings</Link>
2020-08-06 08:03:07 +02:00
<UserButton />
2020-08-05 07:45:05 +02:00
</div>
</div>
)}
</div>
2020-07-24 04:56:55 +02:00
</header>
);
}