Skip to content

Commit

Permalink
created corpus component
Browse files Browse the repository at this point in the history
  • Loading branch information
phuang00 committed Jul 14, 2021
1 parent 54d8bed commit 7eed0c0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions frontend/components/Corpus.js
Original file line number Diff line number Diff line change
@@ -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 (
<div className="container-fluid">
{loading
? <p>Currently loading Corpus...</p>
: <div>
<h1>{corpusData.title}</h1>
<h6>Description</h6>
<p>{corpusData.description}</p>
</div>
}
</div>
);
};

Corpus.propTypes = {
id: PropTypes.number
};

export default Corpus;
Empty file.

0 comments on commit 7eed0c0

Please sign in to comment.