From 7eed0c04061a1055ebaba2ba437114f77559de66 Mon Sep 17 00:00:00 2001 From: Peihua Huang Date: Wed, 14 Jul 2021 14:47:27 -0400 Subject: [PATCH] created corpus component --- frontend/components/Corpus.js | 33 ++++++++++++++++++++++++++ frontend/components/Corpus.module.scss | 0 2 files changed, 33 insertions(+) create mode 100644 frontend/components/Corpus.js create mode 100644 frontend/components/Corpus.module.scss diff --git a/frontend/components/Corpus.js b/frontend/components/Corpus.js new file mode 100644 index 00000000..5963d04f --- /dev/null +++ b/frontend/components/Corpus.js @@ -0,0 +1,33 @@ +import React, {useEffect, useState} from "react"; +import * as PropTypes from "prop-types"; +// import STYLES from "./Corpus.module.scss"; +import {getCookie} from "../common"; + +const Corpus = ({id}) => { + + const [corpusData, setCorpusData] = useState({}); + const [loading, setLoading] = useState(false); + + useEffect(() => { + fetch(`/api/corpus/${id}`) + }, []); + + return ( +
+ {loading + ?

Currently loading Corpus...

+ :
+

{corpusData.title}

+
Description
+

{corpusData.description}

+
+ } +
+ ); +}; + +Corpus.propTypes = { + id: PropTypes.number +}; + +export default Corpus; diff --git a/frontend/components/Corpus.module.scss b/frontend/components/Corpus.module.scss new file mode 100644 index 00000000..e69de29b