File size: 1,486 Bytes
1e92f2d |
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 |
import React, { Component } from 'react'
import Title from '../Title';
import CartColumns from './CartColumns';
import EmptyCart from './EmptyCart';
import { ProductConsumer} from '../../context';
import CartList from './CartList';
import CartTotals from "./CartTotals";
export default class Store extends Component {
render() {
return (
<section>
<ProductConsumer>
{value => {
const { cart } = value;
if (cart.length > 0) {
return (
<React.Fragment>
<div className='h-full'>
<Title name="your" title="cart" />
<CartColumns />
<CartList value={value} />
<CartTotals value={value} history={this.props.history} />
</div>
</React.Fragment>
);
} else {
return(
<div className='h-full'>
<EmptyCart />;
</div>
)
}
}}
</ProductConsumer>
</section>
);
}
}
|