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

View file

@ -1,9 +1,43 @@
.errorModalContent {
display: flex;
flex-direction: column;
align-items: center;
.header {
padding: 76px 65px;
}
.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;
}
.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) {
return <ErrorModal error={registrationError || error} />;
return (
<div className={styles.room}>
<ErrorModal error={registrationError || error} />
</div>
);
}
return <GroupCall client={client} />;
@ -108,11 +112,7 @@ export function GroupCall({ client }) {
}, [groupCall]);
if (loading) {
return (
<div className={styles.room}>
<LoadingRoomView />
</div>
);
return <LoadingRoomView />;
}
if (error) {