blob: 1805897c9ddfccfcf26324544d52fc7045b5a0e6 (
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
|
/** @jsx jsx */
import { jsx } from "@emotion/react";
import { Link } from "react-router-dom";
import { useParams } from "react-router";
import HeaderBar from "../components/HeaderBar";
import { useEffect, useState } from "react";
import { Form, getForm } from "../api/forms";
import Loading from "../components/Loading";
interface PathParams {
id: string
}
function FormPage(): JSX.Element {
const { id } = useParams<PathParams>();
const [form, setForm] = useState<Form>();
useEffect(() => {
getForm(id).then(form => {
setForm(form);
});
});
if (!form) {
return <Loading/>;
}
return <div>
<HeaderBar title={form.name}/>
<div css={{marginLeft: "20px"}}>
<h1>{form.description}</h1>
<Link to="/" css={{color: "white"}}>Return home</Link>
</div>
</div>;
}
export default FormPage;
|