Download amazon-clone/src/Checkout.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.78 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/amazon-clone/src/Checkout.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@f5071caa249115f3b590492f1c8eb471e02aae4b/amazon-clone/src/Checkout.js
-
curl -L -o Checkout.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/amazon-clone/src/Checkout.js
1.78 kB
| import React, { Fragment } from "react"; | |
| import "./Checkout.css"; | |
| import Subtotal from "./Subtotal"; | |
| import { useStateValue } from "./StateProvider"; | |
| import CheckoutProduct from "./CheckoutProduct"; | |
| import { Link, useHistory } from "react-router-dom"; | |
| import FlipMove from "react-flip-move"; | |
| function Checkout() { | |
| const history = useHistory(); | |
| const [{ basket, user, drawer }, dispatch] = useStateValue(); | |
| return ( | |
| <Fragment> | |
| <Link to="/"> | |
| <div className="checkout__center"> | |
| <img | |
| src="https://miro.medium.com/max/396/0*bVnfVVG7Y7qXQcO1" | |
| style={{ height: 70, marginTop: 20 }} | |
| onClick={() => | |
| dispatch({ | |
| type: "SET_DRAWER", | |
| toggle: false, | |
| }) | |
| } | |
| /> | |
| </div> | |
| </Link> | |
| <div className="checkout"> | |
| <div className="checkout__left"> | |
| <img | |
| className="checkout__ad" | |
| alt="" | |
| src="https://images-na.ssl-images-amazon.com/images/G/02/UK_CCMP/TM/OCC_Amazon1._CB423492668_.jpg" | |
| /> | |
| <div> | |
| <h3>Hello {user?.email}</h3> | |
| <h2 className="checkout__title">Your Shopping Basket</h2> | |
| </div> | |
| <FinalProducts /> | |
| </div> | |
| <div className="checkout__right"> | |
| <Subtotal /> | |
| </div> | |
| </div> | |
| </Fragment> | |
| ); | |
| } | |
| const FinalProducts = () => { | |
| const [{ basket, user }, dispatch] = useStateValue(); | |
| return ( | |
| <Fragment> | |
| {basket.map((item) => ( | |
| <CheckoutProduct | |
| id={item.id} | |
| price={item.price} | |
| rating={item.rating} | |
| image={item.image} | |
| title={item.title} | |
| /> | |
| ))} | |
| </Fragment> | |
| ); | |
| }; | |
| export default Checkout; | |