-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
152 additions
and
30 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React, { Component } from 'react'; | ||
import { connect } from 'react-redux'; | ||
import { ordersReducer } from '../../utils/order'; | ||
import cssModule from './MyOrders.module.css'; | ||
|
||
class MyOrders extends Component { | ||
componentDidMount() { | ||
console.log(); | ||
} | ||
render() { | ||
const totalOrders = ordersReducer(this.props.orders); | ||
return ( | ||
<div className={cssModule.fullHeightContainer}> | ||
<div className={cssModule.container}> | ||
<div className={cssModule.title}> | ||
<h3>Riepilogo dei miei ordini</h3> | ||
</div> | ||
{Object.keys(totalOrders).map((orderId, id) => { | ||
if (totalOrders[orderId].quantity === 0) return null; | ||
return ( | ||
<div className={cssModule.order} key={id}> | ||
<span className={cssModule.orderName}> | ||
{totalOrders[orderId].descr} | ||
</span> | ||
<span className={cssModule.orderCount}> | ||
{totalOrders[orderId].quantity} | ||
</span> | ||
</div> | ||
); | ||
})} | ||
</div> | ||
</div> | ||
); | ||
} | ||
} | ||
const mapStateToProps = state => ({ | ||
orders: state.orders.orderList.filter( | ||
order => order.email === state.auth.user.email | ||
) | ||
}); | ||
|
||
const mapDispatchToProps = {}; | ||
|
||
export default connect( | ||
mapStateToProps, | ||
mapDispatchToProps | ||
)(MyOrders); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
.container { | ||
display: flex; | ||
width: 100%; | ||
max-width: 900px; | ||
margin: auto; | ||
border: dashed 3px; | ||
padding: 25px; | ||
flex-direction: column; | ||
background: #FFF; | ||
} | ||
|
||
.orderName { | ||
display: flex; | ||
width: 100%; | ||
justify-content: flex-end; | ||
text-align: right; | ||
} | ||
|
||
.orderCount { | ||
display: flex; | ||
width: 200px; | ||
align-self: flex-end; | ||
justify-content: flex-end; | ||
} | ||
|
||
.title { | ||
text-align: center; | ||
padding: 20px; | ||
} | ||
|
||
.footer { | ||
text-align: right; | ||
padding-top: 30px | ||
} | ||
|
||
.order { | ||
border-bottom: solid 1px; | ||
display: flex; | ||
flex-wrap: nowrap; | ||
padding: 15px 10px; | ||
} | ||
|
||
.fullHeightContainer { | ||
display: flex; | ||
width: 100%; | ||
padding: 15px; | ||
flex-direction: column; | ||
align-self: center | ||
} |
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
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