forked from module-federation/module-federation-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOrderService.js
More file actions
101 lines (96 loc) · 2.46 KB
/
OrderService.js
File metadata and controls
101 lines (96 loc) · 2.46 KB
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
100
101
import {
Container,
Grid,
makeStyles,
Table,
TableBody,
TableCell,
TableHead,
TableRow,
Typography,
Paper,
} from "@material-ui/core";
import React from "react";
import { orders } from "./data";
import { useServiceContext } from "shell/Service";
function preventDefault(event) {
event.preventDefault();
}
function Title() {
return (
<Typography component="h2" variant="h6" color="primary" gutterBottom>
Recent Orders
</Typography>
);
}
function OrderRow(props) {
return (
<TableRow key={props.order.id}>
<TableCell>{props.order.date}</TableCell>
<TableCell>{props.order.name}</TableCell>
<TableCell>{props.order.shipTo}</TableCell>
<TableCell>{props.order.paymentMethod}</TableCell>
<TableCell align="right">{props.order.amount}</TableCell>
</TableRow>
);
}
const useStyles = makeStyles((theme) => ({
appBarSpacer: theme.mixins.toolbar,
content: {
flexGrow: 1,
height: "100vh",
overflow: "auto",
},
container: {
paddingTop: theme.spacing(4),
paddingBottom: theme.spacing(4),
},
paper: {
padding: theme.spacing(2),
display: "flex",
flexDirection: "column",
overflow: "auto",
},
}));
export default function OrderService() {
const classes = useStyles();
const serviceContext = useServiceContext();
React.useEffect(() => {
serviceContext.setService({ title: "Orders" });
}, []);
return (
<main className={classes.content}>
<div className={classes.appBarSpacer} />
<Container maxWidth="lg" className={classes.container}>
<Grid item xs={12}>
<Paper className={classes.paper}>
<Typography
component="h1"
variant="h6"
color="primary"
gutterBottom
>
Orders
</Typography>
<Table>
<TableHead>
<TableRow>
<TableCell>Date</TableCell>
<TableCell>Name</TableCell>
<TableCell>Ship To</TableCell>
<TableCell>Payment Method</TableCell>
<TableCell align="right">Sale Amount</TableCell>
</TableRow>
</TableHead>
<TableBody>
{orders.map((order) => (
<OrderRow order={order} key={order.id} />
))}
</TableBody>
</Table>
</Paper>
</Grid>
</Container>
</main>
);
}