2021-08-20 00:49:45 +00:00
|
|
|
import classNames from "classnames";
|
|
|
|
import React from "react";
|
2021-11-30 00:19:48 +00:00
|
|
|
import { Link, useHistory } from "react-router-dom";
|
2021-08-20 00:49:45 +00:00
|
|
|
import styles from "./Header.module.css";
|
2021-11-30 00:19:48 +00:00
|
|
|
import { ReactComponent as LogoIcon } from "./Logo.svg";
|
|
|
|
import { ReactComponent as VideoIcon } from "./icons/Video.svg";
|
|
|
|
import { ReactComponent as ArrowLeftIcon } from "./icons/ArrowLeft.svg";
|
2021-08-20 00:49:45 +00:00
|
|
|
|
2021-11-30 00:19:48 +00:00
|
|
|
export function RoomHeader({ roomName, children }) {
|
2021-08-20 00:49:45 +00:00
|
|
|
return (
|
2021-11-30 00:19:48 +00:00
|
|
|
<Header>
|
|
|
|
<LeftNav>
|
|
|
|
<div className={styles.roomAvatar}>
|
|
|
|
<VideoIcon width={16} height={16} />
|
|
|
|
</div>
|
|
|
|
<h3>{roomName}</h3>
|
|
|
|
</LeftNav>
|
|
|
|
<RightNav>{children}</RightNav>
|
|
|
|
</Header>
|
2021-08-20 00:49:45 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-11-30 00:19:48 +00:00
|
|
|
export function RoomSetupHeader({ roomName, children }) {
|
|
|
|
const history = useHistory();
|
|
|
|
|
2021-08-20 00:49:45 +00:00
|
|
|
return (
|
2021-11-30 00:19:48 +00:00
|
|
|
<Header>
|
|
|
|
<LeftNav>
|
|
|
|
<button className={styles.backButton} onClick={() => history.goBack()}>
|
|
|
|
<ArrowLeftIcon width={16} height={16} />
|
|
|
|
<div className={styles.roomAvatar}>
|
|
|
|
<VideoIcon width={16} height={16} />
|
|
|
|
</div>
|
|
|
|
<h3>{roomName}</h3>
|
|
|
|
</button>
|
|
|
|
</LeftNav>
|
|
|
|
<RightNav>{children}</RightNav>
|
|
|
|
</Header>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export function HomeHeader({ userName, signedIn, onLogout }) {
|
|
|
|
return (
|
|
|
|
<Header>
|
|
|
|
<LeftNav>
|
|
|
|
<Link className={styles.logo} to="/">
|
|
|
|
<LogoIcon width={32} height={32} />
|
|
|
|
</Link>
|
|
|
|
</LeftNav>
|
|
|
|
{signedIn && (
|
|
|
|
<RightNav>
|
|
|
|
<span className={styles.userName}>{userName}</span>
|
|
|
|
<button
|
|
|
|
className={styles.signOutButton}
|
|
|
|
type="button"
|
|
|
|
onClick={onLogout}
|
|
|
|
>
|
|
|
|
Sign Out
|
|
|
|
</button>
|
|
|
|
</RightNav>
|
|
|
|
)}
|
|
|
|
</Header>
|
2021-08-20 00:49:45 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-11-30 00:19:48 +00:00
|
|
|
export function Header({ children, className, ...rest }) {
|
2021-08-20 00:49:45 +00:00
|
|
|
return (
|
2021-11-30 00:19:48 +00:00
|
|
|
<header className={classNames(styles.header, className)} {...rest}>
|
2021-08-20 00:49:45 +00:00
|
|
|
{children}
|
2021-11-30 00:19:48 +00:00
|
|
|
</header>
|
2021-08-20 00:49:45 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-11-30 00:19:48 +00:00
|
|
|
export function LeftNav({ children, className, ...rest }) {
|
2021-08-20 00:49:45 +00:00
|
|
|
return (
|
2021-11-30 00:19:48 +00:00
|
|
|
<div
|
|
|
|
className={classNames(styles.nav, styles.leftNav, className)}
|
|
|
|
{...rest}
|
|
|
|
>
|
2021-08-20 00:49:45 +00:00
|
|
|
{children}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2021-08-20 23:23:12 +00:00
|
|
|
|
2021-11-30 00:19:48 +00:00
|
|
|
export function RightNav({ children, className, ...rest }) {
|
2021-08-20 23:23:12 +00:00
|
|
|
return (
|
2021-11-30 00:19:48 +00:00
|
|
|
<div
|
|
|
|
className={classNames(styles.nav, styles.rightNav, className)}
|
|
|
|
{...rest}
|
|
|
|
>
|
|
|
|
{children}
|
|
|
|
</div>
|
2021-08-20 23:23:12 +00:00
|
|
|
);
|
|
|
|
}
|