doc: add moment, CheckoutProduct and CurrencyFormat
This commit is contained in:
1 parent
2bd6b8c44d
commit
a7e7f90975
1 file changed
+33
-2
@@ -1,8 +1,39 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
|
import moment from "moment";
|
||||||
|
import CheckoutProduct from "../CheckoutProduct";
|
||||||
|
import CurrencyFormat from "react-currency-format";
|
||||||
import "./Order.css";
|
import "./Order.css";
|
||||||
|
|
||||||
function Order() {
|
function Order({ order }) {
|
||||||
return <section>Order</section>;
|
return (
|
||||||
|
<div className="order">
|
||||||
|
<h2>Order</h2>
|
||||||
|
<p>{moment.unix(order.data.created).format("MMMM Do YYYY, h:mma")}</p>
|
||||||
|
<p className="order__id">
|
||||||
|
<small>{order.id}</small>
|
||||||
|
</p>
|
||||||
|
{order.data.basket?.map((item) => (
|
||||||
|
<CheckoutProduct
|
||||||
|
id={item.id}
|
||||||
|
title={item.title}
|
||||||
|
image={item.image}
|
||||||
|
price={item.price}
|
||||||
|
rating={item.rating}
|
||||||
|
hideButton
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
<CurrencyFormat
|
||||||
|
renderText={(value) => (
|
||||||
|
<h3 className="order__total">Order Total: {value}</h3>
|
||||||
|
)}
|
||||||
|
decimalScale={2}
|
||||||
|
value={order.data.amount / 100}
|
||||||
|
displayType={"text"}
|
||||||
|
thousandSeparator={true}
|
||||||
|
prefix={"$"}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Order;
|
export default Order;
|
||||||
Reference in new issue
Block a user