umami/components/Header.js

35 lines
1.0 KiB
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-07 07:03:02 +02:00
import Icon from './Icon';
import Logo from 'assets/logo.svg';
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-07 07:03:02 +02:00
<div className={styles.title}>
<Icon icon={<Logo />} size="L" className={styles.logo} />
{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>
);
}