Update error modal styling

This commit is contained in:
Robert Long 2021-12-10 16:22:42 -08:00
commit aa988e9f4a
3 changed files with 63 additions and 32 deletions

View file

@ -1,8 +1,8 @@
import React, { useEffect } from "react"; import React, { useEffect } from "react";
import { Center, Content, Modal } from "./Layout";
import { Link, useLocation } from "react-router-dom"; import { Link, useLocation } from "react-router-dom";
import { ErrorMessage } from "./Input"; import { ErrorMessage } from "./Input";
import styles from "./ErrorModal.module.css"; import styles from "./ErrorModal.module.css";
import { Header, HeaderLogo, LeftNav, RightNav } from "./Header";
export function ErrorModal({ error }) { export function ErrorModal({ error }) {
const location = useLocation(); const location = useLocation();
@ -12,25 +12,22 @@ export function ErrorModal({ error }) {
}, [error]); }, [error]);
return ( return (
<Content> <>
<Center> <Header>
<Modal> <LeftNav>
<h2>Error</h2> <HeaderLogo />
<div className={styles.errorModalContent}> </LeftNav>
<RightNav />
</Header>
<div className={styles.container}>
<div className={styles.content}>
<h1>Error</h1>
<ErrorMessage>{error.message}</ErrorMessage> <ErrorMessage>{error.message}</ErrorMessage>
<p> <Link className={styles.homeLink} to="/">
<Link to={{ pathname: "/login", state: { from: location } }}> Return to home screen
Login
</Link> </Link>
</p>
<p>
<Link to={{ pathname: "/register", state: { from: location } }}>
Register
</Link>
</p>
</div> </div>
</Modal> </div>
</Center> </>
</Content>
); );
} }

View file

@ -1,9 +1,43 @@
.errorModalContent { .header {
display: flex; padding: 76px 65px;
flex-direction: column;
align-items: center;
} }
.errorModalContent p { .container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
flex: 1;
}
.content {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
max-width: 660px;
padding: 0 65px;
}
.content > * {
margin-top: 0;
margin-bottom: 32px;
}
.content > :last-child {
margin-bottom: 0; margin-bottom: 0;
} }
.homeLink {
display: flex;
justify-content: center;
align-items: center;
padding: 8px 136px;
color: #0dbd8b;
text-decoration: none;
background: #0dbd8b;
border-radius: 8px;
color: #ffffff;
font-weight: 600;
font-size: 15px;
}

View file

@ -83,7 +83,11 @@ export function Room() {
} }
if (registrationError || error) { if (registrationError || error) {
return <ErrorModal error={registrationError || error} />; return (
<div className={styles.room}>
<ErrorModal error={registrationError || error} />
</div>
);
} }
return <GroupCall client={client} />; return <GroupCall client={client} />;
@ -108,11 +112,7 @@ export function GroupCall({ client }) {
}, [groupCall]); }, [groupCall]);
if (loading) { if (loading) {
return ( return <LoadingRoomView />;
<div className={styles.room}>
<LoadingRoomView />
</div>
);
} }
if (error) { if (error) {