From c87a8fbb59aedc73bff320aee3000338de071ab7 Mon Sep 17 00:00:00 2001 From: Hassan Abouelela Date: Sat, 19 Jun 2021 21:32:07 +0300 Subject: Support Line Breaks In Submitted Text --- package.json | 10 +++++----- src/pages/FormPage.tsx | 11 ++++++++++- yarn.lock | 10 +++++----- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index ff5e786..225ccce 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,11 @@ "private": false, "license": "MIT", "dependencies": { - "@codemirror/basic-setup": "^0.18.2", - "@codemirror/lang-python": "^0.18.0", - "@codemirror/state": "^0.18.7", - "@codemirror/theme-one-dark": "^0.18.1", - "@codemirror/view": "^0.18.14", + "@codemirror/basic-setup": "0.18.2", + "@codemirror/lang-python": "0.18.0", + "@codemirror/state": "0.18.7", + "@codemirror/theme-one-dark": "0.18.1", + "@codemirror/view": "0.18.14", "@emotion/react": "11.4.0", "@fortawesome/fontawesome-svg-core": "1.2.35", "@fortawesome/free-brands-svg-icons": "5.15.3", 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) => {line}
); + submitted_text.push({submitted_text.pop()?.props.children[0]}); + } else { + submitted_text = "Thanks for your response!"; + } + return (
-

{form.submitted_text ?? "Thanks for your response!"}

+

{submitted_text}

Return Home
diff --git a/yarn.lock b/yarn.lock index 04e4d7a..bfcce3d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1089,7 +1089,7 @@ "@codemirror/view" "^0.18.0" lezer-tree "^0.13.0" -"@codemirror/basic-setup@^0.18.2": +"@codemirror/basic-setup@0.18.2": version "0.18.2" resolved "https://registry.yarnpkg.com/@codemirror/basic-setup/-/basic-setup-0.18.2.tgz#a766b7e8898ce5d4cd4782c1ebf87d15a0f1965f" integrity sha512-4UNFQ4jhU7wKxJH23AJcZW6Ho54VXUpmbtFnN5amIdtGci4ZLvci4M7JKgKFraHmKfDIYQnSzN8d8ohXR7CRhw== @@ -1182,7 +1182,7 @@ "@codemirror/state" "^0.18.3" "@codemirror/view" "^0.18.0" -"@codemirror/lang-python@^0.18.0": +"@codemirror/lang-python@0.18.0": version "0.18.0" resolved "https://registry.yarnpkg.com/@codemirror/lang-python/-/lang-python-0.18.0.tgz#d317566f7c51d906e3df98bf41a3c9a2ce03ef40" integrity sha512-SZrt+TXD3uih4Cb8lTm7yt7JLIqehgI77PdGQXlPcYB/LHQdOuOPzXOXf8jqu/K+PRN72BFxfvb13teaxdERaQ== @@ -1259,7 +1259,7 @@ "@codemirror/view" "^0.18.0" crelt "^1.0.5" -"@codemirror/state@^0.18.0", "@codemirror/state@^0.18.3", "@codemirror/state@^0.18.6", "@codemirror/state@^0.18.7": +"@codemirror/state@0.18.7", "@codemirror/state@^0.18.0", "@codemirror/state@^0.18.3", "@codemirror/state@^0.18.6": version "0.18.7" resolved "https://registry.yarnpkg.com/@codemirror/state/-/state-0.18.7.tgz#3339a732387bb2c034987c57ccf0649ef2f7c4c1" integrity sha512-cVyTiAC9vv90NKmGOfNtBjyIem3BqKui1L5Hfcxurp8K9votQj2oH9COcgWPnQ2Xs64yC70tEuTt9DF1pj5PFQ== @@ -1271,7 +1271,7 @@ resolved "https://registry.yarnpkg.com/@codemirror/text/-/text-0.18.0.tgz#a4a98862989ccef5545e730b269136d524c6a7c7" integrity sha512-HMzHNIAbjCiCf3tEJMRg6ul01KPuXxQGNiHlHgAnqPguq/CX+L4Nvj5JlWQAI91Pupk18zhmM1c6eaazX4YeTg== -"@codemirror/theme-one-dark@^0.18.1": +"@codemirror/theme-one-dark@0.18.1": version "0.18.1" resolved "https://registry.yarnpkg.com/@codemirror/theme-one-dark/-/theme-one-dark-0.18.1.tgz#fa625db384418e89b778d2ae49824c44d5280e3f" integrity sha512-0XRfWYDfwUlPlN8yrO7bDB+EuHFqUNhTJwgp2iIixZWejuZQK0NxKmjuhkiGsEz25w7toM12uUsNJ5mo7iFQcA== @@ -1288,7 +1288,7 @@ "@codemirror/state" "^0.18.0" "@codemirror/view" "^0.18.0" -"@codemirror/view@^0.18.0", "@codemirror/view@^0.18.14": +"@codemirror/view@0.18.14", "@codemirror/view@^0.18.0": version "0.18.14" resolved "https://registry.yarnpkg.com/@codemirror/view/-/view-0.18.14.tgz#509f2a487e1fa62b6b147e3a9db5aab6ce228495" integrity sha512-b83favt2XtbV343wzmY4e5lTwYBdpklFZ31jJ/SDGixx6Yj5xTgZd6NU6jkK/XOT40D1rcRoKcQfFbbpjLG1SA== -- cgit v1.2.3