doc: add CurrentFormat, getBasketTotal and move payment stylesheet to the bottom

This commit is contained in:
Leon Xu committed 2022-05-07 14:08:03 -07:00
1 parent 475d51c2a1
commit 8b67180daa
1 file changed
+14 -1
+14 -1
View File
@@ -2,8 +2,10 @@ import React, { useState } from "react";
import { useStateValue } from "../../redux/StateProvider";
import { Link } from "react-router-dom";
import CheckoutProduct from "../CheckoutProduct";
import "./Payment.css";
import { CardElement, useElements, useStripe } from "@stripe/react-stripe-js";
import { CurrencyFormat } from "react-currency-format";
import { getBasketTotal } from "../../redux/reducer";
import "./Payment.css";
function Payment() {
const [{ basket, user }, dispatch] = useStateValue();
@@ -58,6 +60,17 @@ function Payment() {
<article className="payment__details">
<form onClick={handleSubmit}>
<CardElement onChange={handleChange} />
<article className="payment__priceContainer">
<CurrencyFormat
renderText={(value) => <h3>Order Total: {value}</h3>}
decimalScale={2}
value={getBasketTotal(basket)}
displayType={"text"}
thousandSeparator={true}
prefix={"$"}
/>
</article>
</form>
</article>
</article>