-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShop.js
80 lines (66 loc) · 2.27 KB
/
Shop.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import React, { Component } from 'react';
import ArticleCard from '../../components/page_components/ArticleCard';
import { FormattedMessage, injectIntl } from 'react-intl'
import { Grid, GridCell, GridInner } from '@rmwc/grid';
import { withRouter } from 'react-router-dom';
import { fetchProducts } from '../../actions/shop';
import { addProductToCart } from '../../actions/cart';
import { connect } from 'react-redux'
import Header from '../../components/page_components/NiceHeader';
class Shop extends Component{
constructor(props) {
super(props);
this.intl = this.props.intl;
};
componentDidMount(){
// this.props.fetchProducts();
};
static pageTitle(){
return <FormattedMessage id='Shop.title' />
}
static pageNavTitle(){
return <FormattedMessage id='Shop.navTitle' />
}
render() {
console.log(this.props);
var articles = null;
if (!this.props.isLoading && this.props.products){
articles = this.props.products.map(article => (
<GridCell phone='4' tablet='4' desktop='6'>
<ArticleCard
article={article}
addCallback={(id) => this.props.addProductToCart(id)}
/>
</GridCell>
));
}
return(
<React.Fragment>
<Grid className="base-outer-grid base-outer-grid--first">
<GridInner>
<GridCell phone='4' tablet='8' desktop='12' style={{textAlign:'center'}}>
Alla biljetter kommer att kunna hämtas ut i biljettältet:
<br/>Mån-Ons 11:30-15:00
<br/>Tors/Fre 11:30-02:30
<br/>Lör 15:00-02:30
<br/>mot uppvisande av QR-kod, eller om du lägger till ditt koden till ditt liu-id på ditt konto, med blipp.
</GridCell>
<GridCell phone='4' tablet='8' desktop='12'>
<Header>
Produkter
</Header>
</GridCell>
{(!this.props.isLoading && this.props.products) ? articles : null}
</GridInner>
</Grid>
</React.Fragment>
);
}
}
const mapStateToProps = (state) => {
return {
products: state.shop.products,
isLoading: state.shop.loading
};
}
export default connect(mapStateToProps, {fetchProducts, addProductToCart})(withRouter(injectIntl(Shop, { withRef: true })));