Download Amazon-clone/src/Components/Home.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.22 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/Amazon-clone/src/Components/Home.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@f5071caa249115f3b590492f1c8eb471e02aae4b/Amazon-clone/src/Components/Home.js
-
curl -L -o Home.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/Amazon-clone/src/Components/Home.js
1.22 kB
| import {React,useState} from "react"; | |
| import "./home.css"; | |
| import Delivery from "../imgs/delivery.png"; | |
| import Popular from "./Category/Popular"; | |
| import Navbar from './Navbar' | |
| function Home() { | |
| const [scrollPosition, setScrollPosition] = useState(0); | |
| document.title = "Amazon" | |
| const handleScroll = () => { | |
| window.scrollTo({ | |
| top: scrollPosition + 750, | |
| behavior: "smooth" | |
| }); | |
| setScrollPosition(scrollPosition + 750); | |
| setTimeout(() => { | |
| setScrollPosition(0); | |
| }, 100); | |
| }; | |
| return ( | |
| <> | |
| <Navbar/> | |
| <div className="content"> | |
| <div className="poster-area"> | |
| <div className="poster-data"> | |
| <p className="poster-head">Free Delivery!</p> | |
| <p className="poster-desc"> | |
| Don't miss it out! Only today, get free{" "} | |
| <b style={{ fontSize: "22px" }}>Next Day</b> delivery on all | |
| your orders. | |
| </p> | |
| </div> | |
| <button onClick={handleScroll} className="browse-btn">Browse products</button> | |
| </div> | |
| <img src={Delivery} className="delivery" /> | |
| <Popular /> | |
| </div> | |
| </> | |
| ); | |
| } | |
| export default Home; | |