aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/AuthorizationSplash.tsx
blob: 6fd211a77ba83f5c64ea2b341a3db6e41a14232b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/** @jsx jsx */
import { css, jsx } from "@emotion/react";
import { useSelector } from "react-redux";
import { type RootState } from "../store";

const splashStyles = css`
position: fixed;
width: 100%;
height: 100%;
top: 0;
transition: background-color 0.5s ease, opacity 0.5s ease;
`;

const innerText = css`
text-align: center;
vertical-align: middle;
`;

const spacer = css`
height: 30%;
`;

function AuthorizationSplash(): JSX.Element {
    const authorizing = useSelector<RootState, boolean>(state => state.authorization.authorizing);

    const background = `rgba(0, 0, 0, ${authorizing ? "0.90" : "0"})`;

    return <div css={css`
          ${splashStyles}
          background-color: ${background};
          opacity: ${authorizing ? "1" : "0"};
          z-index: ${authorizing ? "10" : "-10"};
        `}>
        <div css={spacer}/>
        <div css={innerText}>
            <h1 css={{fontSize: "3em"}}>Authorization in progress</h1>
            <h2>Login with Discord in the opened window and return to this tab once complete.</h2>
        </div>
    </div>;
}

export default AuthorizationSplash;