From dbaf467a20b2178f6311a97f0f63af388d952ed6 Mon Sep 17 00:00:00 2001 From: Robert Long Date: Mon, 29 Nov 2021 16:19:48 -0800 Subject: [PATCH] Update room and room setup headers --- src/Header.jsx | 99 ++++++++++++++++++++++++++++------------- src/Header.module.css | 57 +++++++++++++++++++----- src/Home.jsx | 7 +-- src/Room.jsx | 39 ++++++---------- src/icons/ArrowLeft.svg | 3 ++ 5 files changed, 134 insertions(+), 71 deletions(-) create mode 100644 src/icons/ArrowLeft.svg diff --git a/src/Header.jsx b/src/Header.jsx index 568f3097..01405275 100644 --- a/src/Header.jsx +++ b/src/Header.jsx @@ -1,8 +1,67 @@ import classNames from "classnames"; import React from "react"; -import { Link } from "react-router-dom"; +import { Link, useHistory } from "react-router-dom"; import styles from "./Header.module.css"; -import { ReactComponent as Logo } from "./Logo.svg"; +import { ReactComponent as LogoIcon } from "./Logo.svg"; +import { ReactComponent as VideoIcon } from "./icons/Video.svg"; +import { ReactComponent as ArrowLeftIcon } from "./icons/ArrowLeft.svg"; + +export function RoomHeader({ roomName, children }) { + return ( +
+ +
+ +
+

{roomName}

+
+ {children} +
+ ); +} + +export function RoomSetupHeader({ roomName, children }) { + const history = useHistory(); + + return ( +
+ + + + {children} +
+ ); +} + +export function HomeHeader({ userName, signedIn, onLogout }) { + return ( +
+ + + + + + {signedIn && ( + + {userName} + + + )} +
+ ); +} export function Header({ children, className, ...rest }) { return ( @@ -14,18 +73,10 @@ export function Header({ children, className, ...rest }) { export function LeftNav({ children, className, ...rest }) { return ( -
- - - - {children} -
- ); -} - -export function CenterNav({ children, className, ...rest }) { - return ( -
+
{children}
); @@ -33,23 +84,11 @@ export function CenterNav({ children, className, ...rest }) { export function RightNav({ children, className, ...rest }) { return ( -
+
{children}
); } - -export function UserNav({ signedIn, userName, onLogout }) { - if (!signedIn) { - return null; - } - - return ( - - {userName} - - - ); -} diff --git a/src/Header.module.css b/src/Header.module.css index 511064ec..dc0950b6 100644 --- a/src/Header.module.css +++ b/src/Header.module.css @@ -1,16 +1,18 @@ .header { position: relative; display: flex; - justify-content: center; + justify-content: space-between; align-items: center; height: 64px; user-select: none; flex-shrink: 0; } -.leftNav { - position: absolute; - left: 20px; +.nav { + display: flex; + align-items: center; + white-space: nowrap; + margin: 0 20px; } .logo { @@ -19,19 +21,52 @@ text-decoration: none; } -.rightNav { - position: absolute; - right: 20px; - max-width: 40%; - white-space: nowrap; - display: flex; +.leftNav > * { + margin-right: 12px; } .rightNav > * { margin-right: 24px; } -.rightNav > :last-child { +.nav > :last-child { + margin-right: 0; +} + +.roomAvatar { + position: relative; + display: flex; + justify-content: center; + align-items: center; + width: 36px; + height: 36px; + border-radius: 36px; + background-color: #5c56f5; +} + +.roomAvatar > * { + fill: white; + stroke: white; +} + +.backButton { + background: transparent; + border: none; + display: flex; + color: var(--textColor1); + cursor: pointer; + align-items: center; +} + +.backButton h3 { + margin: 0; +} + +.backButton > * { + margin-right: 12px; +} + +.backButton > :last-child { margin-right: 0; } diff --git a/src/Home.jsx b/src/Home.jsx index c3ee9d8a..bdf896d4 100644 --- a/src/Home.jsx +++ b/src/Home.jsx @@ -20,7 +20,7 @@ import { useGroupCallRooms, usePublicRooms, } from "./ConferenceCallManagerHooks"; -import { Header, LeftNav, UserNav } from "./Header"; +import { HomeHeader } from "./Header"; import ColorHash from "color-hash"; import styles from "./Home.module.css"; import { FieldRow, InputField, Button, ErrorMessage } from "./Input"; @@ -121,10 +121,7 @@ export function Home({ client, onLogout }) { return ( <> -
- - -
+
diff --git a/src/Room.jsx b/src/Room.jsx index 7225bf5c..d42236b2 100644 --- a/src/Room.jsx +++ b/src/Room.jsx @@ -26,7 +26,7 @@ import { DropdownButton, SettingsButton, } from "./RoomButton"; -import { Header, LeftNav, RightNav, CenterNav } from "./Header"; +import { Header, LeftNav, RoomHeader, RoomSetupHeader } from "./Header"; import { Button } from "./Input"; import { GroupCallState } from "matrix-js-sdk/src/webrtc/groupCall"; import VideoGrid, { @@ -249,12 +249,7 @@ function RoomSetupView({ return ( <> -
- - -

{roomName}

-
-
+
{hasLocalParticipant && (

Warning, you are signed into this call on another device.

@@ -470,24 +465,18 @@ function InRoomView({ return ( <> -
- - -

{roomName}

-
- - setShowInspector((prev) => !prev)} - /> - - -
+ + setShowInspector((prev) => !prev)} + /> + + {items.length === 0 ? (

Waiting for other participants...

diff --git a/src/icons/ArrowLeft.svg b/src/icons/ArrowLeft.svg new file mode 100644 index 00000000..947ce922 --- /dev/null +++ b/src/icons/ArrowLeft.svg @@ -0,0 +1,3 @@ + + +