aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ks129 <[email protected]>2020-12-14 10:51:51 +0200
committerGravatar ks129 <[email protected]>2020-12-14 10:51:51 +0200
commit42782aa26d9f87d0d6a1967d8bc4caf5d7a5ea2d (patch)
tree3263f332e0606a50021b9e89747461c0a247bd8e
parentUpdate getForms function to fetch data from API (diff)
Update FormListing component to match with new forms interface
-rw-r--r--src/components/FormListing.tsx10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/components/FormListing.tsx b/src/components/FormListing.tsx
index 2493608..c53cf67 100644
--- a/src/components/FormListing.tsx
+++ b/src/components/FormListing.tsx
@@ -9,15 +9,15 @@ import Tag from "./Tag";
import colors from "../colors";
-import { AllFormsForm } from "../api/forms";
+import { Form, FormFeatures } from "../api/forms";
interface FormListingProps {
- form: AllFormsForm
+ form: Form
}
function FormListing({ form }: FormListingProps) {
const listingStyle = css`
- background-color: ${form.open ? colors.success : colors.darkButNotBlack};
+ background-color: ${form.features.includes(FormFeatures.Open) ? colors.success : colors.darkButNotBlack};
width: 60%;
padding: 20px;
margin-top: 20px;
@@ -39,13 +39,13 @@ function FormListing({ form }: FormListingProps) {
let closedTag;
- if (!form.open) {
+ if (!form.features.includes(FormFeatures.Open)) {
closedTag = <Tag text="CLOSED" color={colors.error}/>
};
return <Link to={`/form/${form.id}`} css={listingStyle}>
<div>
- <h3 css={{fontSize: "1.5em", marginBottom: "0"}}>{closedTag}{form.title} <FontAwesomeIcon icon={faArrowRight} css={{fontSize: "0.75em", paddingBottom: "1px"}}/></h3>
+ <h3 css={{fontSize: "1.5em", marginBottom: "0"}}>{closedTag}{form.name} <FontAwesomeIcon icon={faArrowRight} css={{fontSize: "0.75em", paddingBottom: "1px"}}/></h3>
<p css={{marginTop: "5px"}}>{form.description}</p>
</div>
</Link>