Skip to content

Commit

Permalink
day4
Browse files Browse the repository at this point in the history
  • Loading branch information
chintasiva committed Feb 24, 2023
2 parents 4c255ae + 93d21bb commit e1b2577
Show file tree
Hide file tree
Showing 15 changed files with 914 additions and 676 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"cSpell.words": ["afterpay", "Belk"]
"cSpell.words": ["afterpay", "alldata", "Belk", "Outdoorsman", "Relph"]
}
20 changes: 20 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"react-dom": "^18.2.0",
"react-hook-form": "^7.43.2",
"react-icons": "^4.7.1",
"react-paginate": "^8.1.4",
"react-redux": "^8.0.5",
"react-router-dom": "^6.8.1",
"react-scripts": "5.0.1",
Expand Down
4 changes: 1 addition & 3 deletions src/AllRoutes/AllRoutes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ const AllRoutes = () => {
<Routes>
<Route path="/" element={<HomePage />} />
<Route path="/products/:path" element={<ProductsPage />} />
<Route path="/single" element={<SingleProductPage />} />
<Route path="/register" element={<RegisterPage />} />
<Route path="/signin" element={<Signin />} />
<Route path="/product/:id" element={<SingleProductPage />} />
</Routes>
);
};
Expand Down
8 changes: 3 additions & 5 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import AllRoutes from "./AllRoutes/AllRoutes";
import UpperFooter from "./components/UpperFooter";
import HomePage from "./components/HomePage";

import NavTop from "./components/Navbar/NavTop";
import LowerFooter from "./components/LowerFooter";

function App() {
return (
<div>
<>
<NavTop />

<AllRoutes />
<UpperFooter />
</div>
</>
);
}

Expand Down
79 changes: 46 additions & 33 deletions src/components/Navbar/NavTop.jsx
Original file line number Diff line number Diff line change
@@ -1,36 +1,49 @@
import React from 'react'
import { FiSearch } from "react-icons/fi"
import { RxCardStackPlus } from "react-icons/rx"
import { AiFillDollarCircle } from "react-icons/ai"
import { BsBagPlus } from "react-icons/bs"
import "../../styles/NavTop.css"
import Hamburger from './Hamburger'
import NavBottom from './NavBottom'
import AccountDropdown from '../Model'
import { Link } from "react-scroll"
import React from "react";
import { FiSearch } from "react-icons/fi";
import { RxCardStackPlus } from "react-icons/rx";
import { AiFillDollarCircle } from "react-icons/ai";
import { BsBagPlus } from "react-icons/bs";
import "../../styles/NavTop.css";
import Hamburger from "./Hamburger";
import NavBottom from "./NavBottom";
import AccountDropdown from "../Model";
const NavTop = () => {

return (
<div div id='maindiv'>
<div className="container">
<Hamburger />
<div className="logo">
<Link to={"home"} smooth duration={1500} > <img src="https://i.ibb.co/d27npvV/Lint-trimmy-1.png" alt="logo" /></Link>
</div>
<div className="search">
<input id='inp' type="text" placeholder="Search" />
<span><FiSearch /></span>
</div>
<div className="icon_collection">
<span><RxCardStackPlus /><p>Lint rewards+</p></span>
<span><AiFillDollarCircle /><p>Coupons</p></span>
<span><p id='mod'><AccountDropdown /></p></span>
<span><BsBagPlus /><p>Bag</p></span>
</div>
</div>
<NavBottom />
return (
<div id="maindiv">
<div className="container">
<Hamburger />
<div className="logo">
<img src="https://i.ibb.co/d27npvV/Lint-trimmy-1.png" alt="logo" />
</div>
)
}
<div className="search">
<input id="inp" type="text" placeholder="Search" />
<span>
<FiSearch />
</span>
</div>
<div className="icon_collection">
<span>
<RxCardStackPlus />
<p>Lint rewards+</p>
</span>
<span>
<AiFillDollarCircle />
<p>Coupons</p>
</span>
<span>
<p id="mod">
<AccountDropdown />
</p>
</span>
<span>
<BsBagPlus />
<p>Bag</p>
</span>
</div>
</div>
<NavBottom />
</div>
);
};

export default NavTop
export default NavTop;
70 changes: 70 additions & 0 deletions src/components/pagination.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import React from "react";
import { Flex, Button, Text, IconButton } from "@chakra-ui/react";
import { RxDoubleArrowLeft, RxDoubleArrowRight } from "react-icons/rx";
import { IoIosArrowBack, IoIosArrowForward } from "react-icons/io";

let BTN_COUNT = 5;

const getStartingIdx = (current, total) => {
console.log("index");
if (total - current < 2)
return Math.max(current - (BTN_COUNT - 1 - total + current), 1);
return Math.max(current - 2, 1);
};

const Pagination = ({ current, total, handlePageChange }) => {
console.log("pagination");
let btns = [];
let start = getStartingIdx(current, total);
for (let i = start; i < Math.min(start + BTN_COUNT, total + 1); i++) {
btns.push(
<Button
key={i}
size="md"
background="transparent"
isDisabled={i === current}
onClick={() => handlePageChange(i)}>
{i}
</Button>
);
}
return (
<Flex gap="5px" mt="20px" align="center">
<IconButton
size="md"
display={current === 1 ? "none" : "flex"}
onClick={() => handlePageChange(1)}
bg="transparent"
aria-label="search productName"
icon={<RxDoubleArrowLeft />}
/>
<IconButton
size="md"
display={current === 1 ? "none" : "flex"}
onClick={() => handlePageChange(current - 1)}
bg="transparent"
aria-label="search productName"
icon={<IoIosArrowBack />}
/>
{btns}
<IconButton
size="md"
display={current === total ? "none" : "flex"}
onClick={() => handlePageChange(current + 1)}
bg="transparent"
aria-label="search productName"
icon={<IoIosArrowForward />}
/>
<IconButton
size="md"
display={current === total ? "none" : "flex"}
onClick={() => handlePageChange(total)}
bg="transparent"
aria-label="search productName"
icon={<RxDoubleArrowRight />}
/>
</Flex>
);
};

export default Pagination;
8 changes: 2 additions & 6 deletions src/components/productsPage/filterDrawer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {

import Filters from "./filters";

function FilterDrawer({ filterHeading, filterBrands, price }) {
function FilterDrawer({ filterHeading, price }) {
const { isOpen, onOpen, onClose } = useDisclosure();

return (
Expand All @@ -24,11 +24,7 @@ function FilterDrawer({ filterHeading, filterBrands, price }) {
<Drawer placement={"left"} onClose={onClose} isOpen={isOpen}>
<DrawerOverlay />
<DrawerContent>
<Filters
filterHeading={filterHeading}
filterBrands={filterBrands}
price={price}
/>
<Filters filterHeading={filterHeading} price={price} />
</DrawerContent>
</Drawer>
</Box>
Expand Down
Loading

0 comments on commit e1b2577

Please sign in to comment.