Skip to content

Commit d5475d6

Browse files
authored
Merge pull request #10 from HX001/Yuqing_FrontEnd
merge Yuqing front end
2 parents 640307a + 01e6739 commit d5475d6

4 files changed

Lines changed: 121 additions & 2 deletions

File tree

0 Bytes
Binary file not shown.

uoft-contribution-frontend/src/components/Home.js

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,61 @@
11
import React, {Component} from 'react';
2+
import ps5 from '../PS5.jpg'
3+
import xbox from '../XBOX.jpg'
4+
5+
import {Container, Row, Col, Alert, Image} from "react-bootstrap";
6+
27

38
class Home extends Component {
9+
handlexbox = event => {
10+
window.localStorage.setItem('console', 'xbox');
11+
//alert(window.localStorage.getItem('console'));
12+
};
13+
14+
handleps5 = event => {
15+
window.localStorage.setItem('console', 'PS5');
16+
//alert(window.localStorage.getItem('console'));
17+
};
18+
419
render() {
20+
function handlePS5 (e){
21+
//window.localStorage.setItem('console', 'PS5');
22+
console.log('hey');
23+
//console.log(window.localStorage.key('console'));
24+
}
25+
26+
function handleXbox(e) {
27+
28+
}
29+
30+
const imageClick = () => {
31+
console.log('Click');
32+
}
33+
534
return (
635
<div>
7-
Home Page......
36+
<Alert variant="warning">
37+
<Alert.Heading>Hello Gamer!</Alert.Heading>
38+
<p>
39+
Welcome to WebSiteBot where you can buy a PS5 or Xbox X. Just click on either a
40+
PS5 or Xbox below and get forwarded to the available suppliers!
41+
</p>
42+
<hr />
43+
<p className="mb-0">
44+
This project is being maintained by Alex Kocab
45+
</p>
46+
</Alert>
47+
48+
<br />
49+
50+
<Container>
51+
<a href = '/suppliers'><Image onClick={this.handleps5} src={ps5} width="500" rounded/></a>
52+
{' '}
53+
<a href = '/suppliers'><Image onClick={this.handlexbox} src={xbox} width="500" rounded/></a>
54+
55+
</Container>
56+
57+
58+
859
</div>
960
);
1061
}

uoft-contribution-frontend/src/components/Main.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { BrowserRouter as Router, Switch, Route } from 'react-router-dom';
33
import Home from "./Home";
44
import UserProfile from "./UserProfile";
55
import Payment from "./Payment";
6-
import CheckoutForm from "./PaymentPage";
6+
import Supplier from "./Supplier";
77

88

99
class Main extends Component {
@@ -25,6 +25,10 @@ class Main extends Component {
2525
<Payment />
2626
</Route>
2727

28+
<Route exact path="/suppliers">
29+
<Supplier />
30+
</Route>
31+
2832

2933
</Switch>
3034
</div>
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import React, {Component} from "react";
2+
import Card from 'react-bootstrap/Card'
3+
import Button from 'react-bootstrap/Button'
4+
import Row from 'react-bootstrap/Row'
5+
import Col from 'react-bootstrap/Col'
6+
import Container from 'react-bootstrap/Container'
7+
8+
class Supplier extends Component {
9+
handleClick(name){
10+
window.location.href="/payment"
11+
localStorage.setItem("supplier",name)
12+
// For now we store the supplier that users chose in the local cache, with the key as "supplier"
13+
// When the user clicks on a supplier, the name of that supplier will be passed into here.
14+
}
15+
16+
render() {
17+
return (
18+
19+
<Container>
20+
<Row>
21+
<Col className="SupplierCard">
22+
<Card style={{ width: '18rem' }}>
23+
<Card.Img variant="top" src="https://www.wave3.com/resizer/1HurzaEJTU8tvKDbB4cxUYvVFUM=/1200x600/cloudfront-us-east-1.images.arcpublishing.com/raycom/RSJIE4RZUVFWFGC55BVQAKZ5S4.jpg" />
24+
<Card.Body>
25+
<Card.Title>Walmart</Card.Title>
26+
<Button variant="primary"
27+
onClick={(ev) => {this.handleClick("Walmart")}}
28+
>Go payment</Button>
29+
{/*<button onClick={(ev) => {this.handle(ev, "Walmart")}}/>*/}
30+
</Card.Body>
31+
</Card>
32+
</Col>
33+
<Col className="SupplierCard">
34+
<Card style={{ width: '18rem' }}>
35+
<Card.Img variant="top" src="https://cdn.mos.cms.futurecdn.net/wiXtq4NPpGbNf6PEHTT4hg-1024-80.jpg.webp" />
36+
<Card.Body>
37+
<Card.Title>Amazon</Card.Title>
38+
<Button variant="primary"
39+
onClick={(ev) => {this.handleClick("Amazon")}}
40+
>Go payment</Button>
41+
</Card.Body>
42+
</Card>
43+
</Col>
44+
<Col className="SupplierCard">
45+
<Card style={{ width: '18rem' }}>
46+
<Card.Img variant="top" src="https://www.rhtc.com.au/Upload/RouseHillTownCentre/Media/Store-Logo/logo-target.jpg?width=250&height=161" />
47+
<Card.Body>
48+
<Card.Title>Target</Card.Title>
49+
<Button variant="primary"
50+
onClick={(ev) => {this.handleClick("Target")}}
51+
>Go payment</Button>
52+
</Card.Body>
53+
</Card>
54+
</Col>
55+
</Row>
56+
</Container>
57+
58+
59+
60+
)
61+
}
62+
}
63+
64+
export default Supplier;

0 commit comments

Comments
 (0)