Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
annotationSystem/src/components/Home.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
61 lines (54 sloc)
2.12 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {useEffect, useState} from 'react'; | |
import '../App.css'; | |
import { Documents } from "./Documents"; | |
import {makeStyles} from '@material-ui/core/styles' | |
import Button from '@material-ui/core/Button'; | |
const useStyles = makeStyles((theme) => ({ | |
theTitle:{ | |
textAlign: 'center', | |
fontSize: '30px', | |
color: 'black', | |
}, | |
Buttonss: { | |
color: '#8420D9', | |
background: 'white', | |
border: 'solid 1px #8420D9', | |
font: "10px", | |
margin: "10px", | |
textDecoration: 'none', | |
"&:hover": { | |
color: 'white', | |
background: '#8420D9', | |
},}, | |
})) | |
function App() { | |
const userID=localStorage.getItem('userID'); | |
console.log (userID) | |
const [documents, setDocuments] = useState([]); | |
const classes = useStyles(); | |
if (userID == null) { | |
window.location.href = "/Login" | |
} | |
useEffect(()=> { | |
fetch('https://deliverrelax-amandarose-5000.codio-box.uk/documents', | |
{ credentials: 'include' }).then(response =>response.json().then(data => {setDocuments(data.documents); | |
}) | |
); | |
},[]); | |
return ( | |
<div className= {classes.profileContainer}> | |
<center> | |
<div className={classes.linkButtons}> | |
<Button className={classes.Buttonss} onClick={() => {window.location=('./Categories/Maths')}}>Home</Button> | |
<Button className={classes.Buttonss} onClick={() => {window.location=('./Categories/Javascript')}}>Javascript</Button> | |
<Button className={classes.Buttonss} onClick={() => {window.location=('./Categories/Algorithms')}}>Algorithms</Button> | |
<Button className={classes.Buttonss} onClick={() => {window.location=('./Categories/Computing')}}>Computing</Button> | |
<Button className={classes.Buttonss} onClick={() => {window.location=('./Categories/Random')}}>Random</Button> | |
</div> | |
</center> | |
<p className= {classes.theTitle}>My Documents</p> | |
<div className="Documents"> | |
<Documents document={documents}/> </div> </div> | |
); | |
} | |
export default App; |