Skip to content

Commit

Permalink
fetch fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanTurner committed Jun 13, 2021
1 parent c13de02 commit db36c01
Show file tree
Hide file tree
Showing 21 changed files with 4,149 additions and 1,642 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "^4.11.4",
"@material-ui/lab": "^4.0.0-alpha.58",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"web-vitals": "^1.0.1"
},
Expand Down
Binary file removed public/favicon.ico
Binary file not shown.
30 changes: 2 additions & 28 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,16 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
content="Wep app to reccommend colleges"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>College Reccommend</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
Binary file removed public/logo192.png
Binary file not shown.
Binary file removed public/logo512.png
Binary file not shown.
25 changes: 0 additions & 25 deletions public/manifest.json

This file was deleted.

3 changes: 0 additions & 3 deletions public/robots.txt

This file was deleted.

38 changes: 0 additions & 38 deletions src/App.css

This file was deleted.

35 changes: 16 additions & 19 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
import logo from './logo.svg';
import './App.css';
import React from "react";
import College from "./College";
import CollegeShow from "./CollegeShow";
import { Switch, Route, Redirect } from "react-router";

function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
);
<Switch>
<Route path='/colleges'>
<College/>
</Route>
<Route path='colleges/:name'>
<CollegeShow/>
</Route>
<Route path='/'>
<Redirect to='/colleges'/>
</Route>
</Switch>
)
}

export default App;
8 changes: 0 additions & 8 deletions src/App.test.js

This file was deleted.

42 changes: 42 additions & 0 deletions src/College.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import React from 'react'
import Grid from "@material-ui/core/Grid";
import CollegeSelect from "./CollegeSelect";
import CollegePreview from "./CollegePreview";
import Typography from "@material-ui/core/Typography";
import { makeStyles } from "@material-ui/core/styles";

const useStyles = makeStyles((theme) => ({
root: {
flexGrow: 1,
textAlign: "center",
},
}));

function College() {
const classes = useStyles();
const [results, setResults] = React.useState({results: []});


return (
<Grid container className={classes.root} spacing={2}>
<Grid item xs={12}>
<Typography gutterBottom variant='h2' component='h1'>
Select Colleges
</Typography>
<Grid container justify='center' spacing={2}>
<CollegeSelect setResults={setResults} />
</Grid>
</Grid>
<Grid item xs={12}>
<Typography gutterBottom variant='h2' component='h1'>
Results :
</Typography>
<Grid container justify='center' spacing={2}>
<CollegePreview results={results} />
</Grid>
</Grid>
</Grid>
);
}

export default College
93 changes: 93 additions & 0 deletions src/CollegePreview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import React from "react";
import Card from "@material-ui/core/Card";
import Grid from "@material-ui/core/Grid";
import { useHistory } from "react-router-dom";
import Typography from "@material-ui/core/Typography";
import { makeStyles } from "@material-ui/core/styles";
import CardContent from "@material-ui/core/CardContent";

const useStyles = makeStyles((theme) => ({
grid: {
display: "flex",
padding: theme.spacing(6),
justifyContent: "center",
alignItems: "center",
textAlign: "center",
},
media: {
justifyContent: "center",
alignItems: "center",
textAlign: "center",
},
}));

export default function CollegePreview({results}) {
const classes = useStyles();
const history = useHistory();

if (!results) {
return (<div>No Results</div>)
}

// const handleClick = (college) => {
// const name = college.name.split(" ").join("")
// history.push(`/colleges/${name}`)
// };
//debugger
const content = results.results.map((college) =>
{
const{ admission_rate,
avg_tuition,
city,
schoolname,
state,
student_pop,
url} = college

return (
<Grid spacing={4} className={classes.grid}>
<Card className={classes.media}>
<CardContent>
<Typography gutterBottom variant='h5' component='h2'>
{schoolname}
</Typography>
<Typography variant='body1' color='textSecondary' component='p'>
College Location State : {state}
</Typography>
<Typography variant='body1' color='textSecondary' component='p'>
College Location City : {city}
</Typography>
<Typography variant='body1' color='textSecondary' component='p'>
College Admision Rate : {admission_rate}
</Typography>
<Typography variant='body1' color='textSecondary' component='p'>
College Average Tuition Cost : {avg_tuition}
</Typography>
<Typography variant='body1' color='textSecondary' component='p'>
College Student Population : {student_pop}
</Typography>
<Typography variant='body1' color='textSecondary' component='p'>
College URL : {url}
</Typography>
</CardContent>
</Card>
</Grid>
);
}
);




return content;

}


{
/* <CardActions>
<Button onClick={() => handleClick(college)} size='small' color='primary'>
Learn More
</Button>
</CardActions> */
}
Loading

0 comments on commit db36c01

Please sign in to comment.