blob: 06fef46dced39cd94a6cac901471ef5621632840 (
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
43
44
45
46
47
48
49
 | /** @jsx jsx */
import { css, jsx } from "@emotion/react";
import { useEffect, useState } from "react";
import HeaderBar from "../components/HeaderBar";
import FormListing from "../components/FormListing";
import OAuth2Button from "../components/OAuth2Button";
import Loading from "../components/Loading";
import ScrollToTop from "../components/ScrollToTop";
import { getForms, Form } from "../api/forms";
function LandingPage(): JSX.Element {
    const [forms, setForms] = useState<Form[]>();
    useEffect(() => {
        const fetchForms = async () => {
            setForms(await getForms());
        };
        fetchForms().then();
    }, []);
    if (!forms) {
        return <Loading/>;
    }
    return <div>
        <HeaderBar/>
        <ScrollToTop/>
        <div>
            <div css={css`
        display: flex;
        align-items: center;
        flex-direction: column;
      `}>
                <h1>Available Forms</h1>
                <OAuth2Button/>
                {forms.map(form => (
                    <FormListing key={form.id} form={form}/>
                ))}
            </div>
        </div>
    </div>;
}
export default LandingPage;
 |