element-call/src/Header.jsx

56 lines
1.3 KiB
React
Raw Normal View History

2021-08-20 00:49:45 +00:00
import classNames from "classnames";
import React from "react";
import { Link } from "react-router-dom";
import styles from "./Header.module.css";
import { ReactComponent as Logo } from "./Logo.svg";
export function Header({ children, className, ...rest }) {
return (
<header className={classNames(styles.header, className)} {...rest}>
{children}
</header>
);
}
export function LeftNav({ children, className, ...rest }) {
return (
<div className={classNames(styles.leftNav, className)} {...rest}>
<Link className={styles.logo} to="/">
<Logo width={32} height={32} />
</Link>
{children}
</div>
);
}
export function CenterNav({ children, className, ...rest }) {
return (
<div className={classNames(styles.centerNav, className)} {...rest}>
{children}
</div>
);
}
export function RightNav({ children, className, ...rest }) {
return (
<div className={classNames(styles.rightNav, className)} {...rest}>
{children}
</div>
);
}
2021-08-20 23:23:12 +00:00
export function UserNav({ signedIn, userName, onLogout }) {
if (!signedIn) {
return null;
}
return (
<RightNav>
<span className={styles.userName}>{userName}</span>
<button className={styles.signOutButton} type="button" onClick={onLogout}>
Sign Out
</button>
</RightNav>
);
}