aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Hassan Abouelela <[email protected]>2021-06-19 21:32:07 +0300
committerGravatar Hassan Abouelela <[email protected]>2021-06-19 21:32:07 +0300
commitc87a8fbb59aedc73bff320aee3000338de071ab7 (patch)
tree231f4b7a94cd92960bf09af0c29433ef51526006 /src
parentMerge pull request #224 from python-discord/codemirror (diff)
Support Line Breaks In Submitted Text
Diffstat (limited to 'src')
-rw-r--r--src/pages/FormPage.tsx11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/pages/FormPage.tsx b/src/pages/FormPage.tsx
index 8852ac5..d7dfd4b 100644
--- a/src/pages/FormPage.tsx
+++ b/src/pages/FormPage.tsx
@@ -159,11 +159,20 @@ function FormPage(): JSX.Element {
if (form && sent) {
const thanksStyle = css`font-family: "Uni Sans", "Hind", "Arial", sans-serif; margin-top: 15.5rem;`;
const divStyle = css`width: 80%;`;
+
+ let submitted_text;
+ if (form.submitted_text) {
+ submitted_text = form.submitted_text.split("\n").map((line, index) => <span key={index}>{line}<br/></span>);
+ submitted_text.push(<span key={submitted_text.length - 1}>{submitted_text.pop()?.props.children[0]}</span>);
+ } else {
+ submitted_text = "Thanks for your response!";
+ }
+
return (
<div>
<HeaderBar title={form.name} description={form.description}/>
<div css={[unselectable, Navigation.containerStyles, divStyle]}>
- <h3 css={thanksStyle}>{form.submitted_text ?? "Thanks for your response!"}</h3>
+ <h3 css={thanksStyle}>{submitted_text}</h3>
<div className={ "return_button closed" }>
<Link to="/" css={Navigation.returnStyles}>Return Home</Link>
</div>