-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHandingOrders.js
99 lines (82 loc) · 1.91 KB
/
HandingOrders.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import styled from "@emotion/styled";
import { useEffect, useState } from "react";
import useHandingOrdersService from "../hooks/useHandingOrdersService";
const HandingOrders = function ({ user: userId }) {
const orders = useHandingOrdersService(userId);
const rows = orders.map(renderOrderRows);
return (
<OrdersTableWrapper className="cssHandingOrders">
<h2>Order</h2>
<OrdersTable>
<thead>
<tr>
<th>商品編號</th>
<th>商品名稱</th>
<th>商品數量</th>
<th>商品價錢</th>
<th>商品備註</th>
</tr>
</thead>
<tbody>{rows}</tbody>
</OrdersTable>
</OrdersTableWrapper>
);
};
const renderOrderRows = function (order) {
return (
<tr key = {order.id} >
<td>{order.id}</td>
<td>{order.name}</td>
<td>1</td>
<td>{order.price}</td>
<td>{order.remark}</td>
</tr>
);
};
const OrdersTable = styled.table`
border-collapse: collapse;
width: 100%;
th {
font-family:微軟正黑體;
//border: black;
background-color: #EEEEEE;
color: #777777;
}
td:nth-of-type(1){
width: 250px;
}
td:nth-of-type(3),
td:nth-of-type(4),
td:nth-of-type(5) {
width: 100px;
}
th,
td {
text-align: left;
padding: 10px;
}
td:nth-of-type(3),
td:nth-of-type(4),
th:nth-of-type(3),
th:nth-of-type(4),
th:nth-of-type(5),
td:nth-of-type(5) {
text-align: right;
}
tbody,
td:not(:nth-of-type(0)) {
border-bottom: #cccccc 2px solid;
padding: 15px;
}
`;
const OrdersTableWrapper = styled.div`
width: 60%;
max-width: 800px;
padding: 25px;
border-radius: 7px;
box-shadow: #666666 0px 0px 6px;
background: #fff;
margin: 3% 0 0 3%;
text-align: left
`;
export default HandingOrders;