From a378b1c9ee096388002f3b0fdc26636e9c1cd57b Mon Sep 17 00:00:00 2001 From: Hassan Abouelela Date: Fri, 1 Jul 2022 00:19:13 +0400 Subject: Restructure FormPage The main FormPage component had gotten very out of hand, with many moving parts that were hard to parse, understand, or modify. This refactors breaks things up into separate files with better defined goals. Most changes are just straight copies without much change, however some structural changes have been introduced as a foundation for improving the app. Signed-off-by: Hassan Abouelela --- src/pages/FormPage/SuccessPage.tsx | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/pages/FormPage/SuccessPage.tsx (limited to 'src/pages/FormPage/SuccessPage.tsx') diff --git a/src/pages/FormPage/SuccessPage.tsx b/src/pages/FormPage/SuccessPage.tsx new file mode 100644 index 0000000..e35bd4d --- /dev/null +++ b/src/pages/FormPage/SuccessPage.tsx @@ -0,0 +1,45 @@ +/** @jsx jsx */ +import {jsx, css} from "@emotion/react"; +import {Link} from "react-router-dom"; + +import {Form} from "../../api/forms"; +import HeaderBar from "../../components/HeaderBar"; +import {unselectable} from "../../commonStyles"; + +import Navigation from "./Navigation"; + + +interface SuccessProps { + form: Form +} + +const thanksStyle = css` + font-family: "Uni Sans", "Hind", "Arial", sans-serif; + margin-top: 15.5rem; +`; + +const divStyle = css` + width: 80%; +`; + +export default function Success(props: SuccessProps): JSX.Element { + let submitted_text; + if (props.form.submitted_text) { + submitted_text = props.form.submitted_text.split("\n").map((line, index) => {line}
); + submitted_text.push({submitted_text.pop()?.props.children[0]}); + } else { + submitted_text = "Thanks for your response!"; + } + + return ( +
+ +
+

{submitted_text}

+
+ Return Home +
+
+
+ ); +} -- cgit v1.2.3