Skip to content

Commit

Permalink
created new banner
Browse files Browse the repository at this point in the history
  • Loading branch information
sksabbirhossain committed Sep 2, 2023
1 parent 4484cd2 commit 9db6ef0
Show file tree
Hide file tree
Showing 6 changed files with 197 additions and 61 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"react-icons": "^4.8.0",
"react-infinite-scroll-component": "^6.1.0",
"react-redux": "^8.0.1",
"react-responsive-carousel": "^3.2.23",
"react-router-dom": "^6.11.2",
"react-scripts": "5.0.1",
"swiper": "^10.1.0",
Expand Down
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<div id="root" class="bg-[#eff0f5]"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
Expand Down
2 changes: 1 addition & 1 deletion src/components/user/Headers/MainHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const MainHeader = () => {
name="search"
value={searchValue}
placeholder="Search Product..."
className="bg-transparent px-2 py-2 focus:outline-none sm:w-full"
className="bg-transparent text-black px-2 py-2 focus:outline-none sm:w-full"
onChange={(e) => setSearchValue(e.target.value)}
/>
<button type="submit" className="pr-3 text-lg text-[#f85606]">
Expand Down
28 changes: 15 additions & 13 deletions src/components/user/ProductCard.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import React from "react";
import { toast } from "react-hot-toast";
import { FaStar } from "react-icons/fa";
import { useDispatch } from "react-redux";
import { Link } from "react-router-dom";
import { addToCart } from "../../features/cart/addToCartSlice";
import createSlug from "../../utils/createSlug";
import { toast } from "react-hot-toast";

export const ProductCard = ({ product }) => {
const { _id, picture, description, price, name, rating } = product || {};
const { _id, picture, description, price, name } = product || {};

const rating = 5;

const dispatch = useDispatch();

Expand All @@ -17,11 +19,11 @@ export const ProductCard = ({ product }) => {
//add to cart
const addToCartHandler = (item) => {
dispatch(addToCart(item));
toast.success("Product Add To Cart")
toast.success("Product Add To Cart");
};

return (
<div className="max-w-[250px] h-[325px] border-gray-100 border rounded-md hover:shadow-lg duration-100 ease-linear">
<div className="md:max-w-[250px] h-[325px] border-gray-100 border rounded-md hover:shadow-lg duration-100 ease-linear">
<Link to={`/product-details/${productSlug}/${_id}`}>
<div className="pt-2">
<img
Expand All @@ -41,18 +43,18 @@ export const ProductCard = ({ product }) => {
<p className="font-normal text-sm">
{description?.substring(1, 45)}...
</p>
<p className="flex items-center text-green-700">
<FaStar />
<FaStar />
<FaStar />
<FaStar />
<FaStar />
<FaStar />
<span className="text-slate-800 text-sm ml-1">({rating?.count})</span>
<p className="flex items-center text-orange-600">
{Array(rating)
.fill()
.map((i) => (
<FaStar />
))}

<span className="text-gray-500 text-sm font-thin ml-1">({rating})</span>
</p>
<div>
<button
className="bg-green-900 duration-100 ease-linear hover:bg-green-700 text-white/80 w-full rounded-md py-1"
className="bg-white duration-200 ease-linear hover:bg-orange-600 text-orange-600 hover:text-white border border-orange-600 w-full rounded-md py-1"
onClick={() => addToCartHandler(product)}
>
Add To Cart
Expand Down
202 changes: 157 additions & 45 deletions src/pages/User/Home/Banner.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,163 @@
import React from "react";
// Import Swiper React components
import { Swiper, SwiperSlide } from "swiper/react";

import "swiper/css";
import "swiper/css/effect-fade";
import "swiper/css/navigation";
import "swiper/css/pagination";

// import required modules
import { Autoplay, EffectFade, Pagination } from "swiper/modules";
import { FaArrowRight } from "react-icons/fa";
import { Carousel } from "react-responsive-carousel";
import "react-responsive-carousel/lib/styles/carousel.min.css";
import { Link } from "react-router-dom";

export const Banner = () => {
return (
<Swiper
pagination={{
dynamicBullets: true,
}}
modules={[Pagination, Autoplay, EffectFade]}
className="mySwiper h-96 w-auto mt-5 container mx-auto rounded-md"
loop={true}
effect={"fade"}
autoplay={{
delay: 2000,
disableOnInteraction: false,
}}
>
<SwiperSlide>
<img
className="w-full h-full object-cover"
src="https://icms-image.slatic.net/images/ims-web/adf3364e-f1a8-4dc8-9140-6fedf54bdb65.jpg"
alt=""
/>
</SwiperSlide>
<SwiperSlide>
<img
className="w-full h-full object-cover"
src="https://icms-image.slatic.net/images/ims-web/08cb6ccd-b909-4c15-9421-c25b26e73644.jpg"
alt=""
/>
</SwiperSlide>
<SwiperSlide>
<img
className="w-full h-full object-cover"
src="https://icms-image.slatic.net/images/ims-web/7de73341-dee6-4793-a51d-367929293352.jpg"
alt=""
/>
</SwiperSlide>
</Swiper>
<div className="container mx-auto mt-1 sm:mt-5">
<div className="md:flex md:gap-5">
<div className="bg-gray-100 p-3 rounded-xl hidden lg:block w-full min-w-[280px] h-80">
<ul className="space-y-1">
<li className="text-gray-600 text-sm hover:text-orange-600 hover:bg-red-100/40 px-2 rounded-md group duration-300 ease-out">
<Link to="/" className="flex justify-between items-center">
<span>Women's & Girls' Fashion</span>
<span className="hidden group-hover:block">
<FaArrowRight />
</span>
</Link>
</li>
<li className="text-gray-600 text-sm hover:text-orange-600 hover:bg-red-100/40 px-2 rounded-md group duration-300 ease-out">
<Link to="/" className="flex justify-between items-center">
<span>Health & Beauty</span>
<span className="hidden group-hover:block">
<FaArrowRight />
</span>
</Link>
</li>
<li className="text-gray-600 text-sm hover:text-orange-600 hover:bg-red-100/40 px-2 rounded-md group duration-300 ease-out">
<Link to="/" className="flex justify-between items-center">
<span>Watches, Bags, Jewellery</span>
<span className="hidden group-hover:block">
<FaArrowRight />
</span>
</Link>
</li>
<li className="text-gray-600 text-sm hover:text-orange-600 hover:bg-red-100/40 px-2 rounded-md group duration-300 ease-out">
<Link to="/" className="flex justify-between items-center">
<span>Men's & Boys' Fashion</span>
<span className="hidden group-hover:block">
<FaArrowRight />
</span>
</Link>
</li>
<li className="text-gray-600 text-sm hover:text-orange-600 hover:bg-red-100/40 px-2 rounded-md group duration-300 ease-out">
<Link to="/" className="flex justify-between items-center">
<span>Mother & Baby</span>
<span className="hidden group-hover:block">
<FaArrowRight />
</span>
</Link>
</li>
<li className="text-gray-600 text-sm hover:text-orange-600 hover:bg-red-100/40 px-2 rounded-md group duration-300 ease-out">
<Link to="/" className="flex justify-between items-center">
<span>Electronics Devices</span>
<span className="hidden group-hover:block">
<FaArrowRight />
</span>
</Link>
</li>
<li className="text-gray-600 text-sm hover:text-orange-600 hover:bg-red-100/40 px-2 rounded-md group duration-300 ease-out">
<Link to="/" className="flex justify-between items-center">
<span>TV & Home Appliances</span>
<span className="hidden group-hover:block">
<FaArrowRight />
</span>
</Link>
</li>
<li className="text-gray-600 text-sm hover:text-orange-600 hover:bg-red-100/40 px-2 rounded-md group duration-300 ease-out">
<Link to="/" className="flex justify-between items-center">
<span>Electronic Accessories</span>
<span className="hidden group-hover:block">
<FaArrowRight />
</span>
</Link>
</li>
<li className="text-gray-600 text-sm hover:text-orange-600 hover:bg-red-100/40 px-2 rounded-md group duration-300 ease-out">
<Link to="/" className="flex justify-between items-center">
<span>Groceries</span>
<span className="hidden group-hover:block">
<FaArrowRight />
</span>
</Link>
</li>
<li className="text-gray-600 text-sm hover:text-orange-600 hover:bg-red-100/40 px-2 rounded-md group duration-300 ease-out">
<Link to="/" className="flex justify-between items-center">
<span>Home & Lifestyle</span>
<span className="hidden group-hover:block">
<FaArrowRight />
</span>
</Link>
</li>
<li className="text-gray-600 text-sm hover:text-orange-600 hover:bg-red-100/40 px-2 rounded-md group duration-300 ease-out">
<Link to="/" className="flex justify-between items-center">
<span>Sports & Outdoors</span>
<span className="hidden group-hover:block">
<FaArrowRight />
</span>
</Link>
</li>
<li className="text-gray-600 text-sm hover:text-orange-600 hover:bg-red-100/40 px-2 rounded-md group duration-300 ease-out">
<Link to="/" className="flex justify-between items-center">
<span>Automotive & Motorbike</span>
<span className="hidden group-hover:block">
<FaArrowRight />
</span>
</Link>
</li>
</ul>
</div>
{/* carousel */}
<Carousel
autoPlay
infiniteLoop
showThumbs={false}
showStatus={false}
interval={4000}
>
<div>
<img
loading="lazy"
className="w-full object-fill rounded-xl h-32 sm:h-52 md:h-80"
src="https://icms-image.slatic.net/images/ims-web/22aa0f64-5ce4-4163-b139-8e13bac1fd4a.jpg"
alt=""
/>
</div>
<div>
<img
loading="lazy"
className="w-full object-fill rounded-xl h-32 sm:h-52 md:h-80"
src="https://icms-image.slatic.net/images/ims-web/ba823c57-436b-4b77-8f58-dc5205af1e80.jpg"
alt=""
/>
</div>
<div>
<img
loading="lazy"
className="w-full object-fill rounded-xl h-32 sm:h-52 md:h-80"
src="https://icms-image.slatic.net/images/ims-web/befb2d4d-9ee3-4da2-bbbf-1befc1670150.jpg"
alt=""
/>
</div>
<div>
<img
loading="lazy"
className="w-full object-fill rounded-xl h-32 sm:h-52 md:h-80"
src="https://icms-image.slatic.net/images/ims-web/08cb6ccd-b909-4c15-9421-c25b26e73644.jpg"
alt=""
/>
</div>
<div>
<img
loading="lazy"
className="w-full object-fill rounded-xl h-32 sm:h-52 md:h-80"
src="https://icms-image.slatic.net/images/ims-web/7de73341-dee6-4793-a51d-367929293352.jpg"
alt=""
/>
</div>
</Carousel>
</div>
</div>
);
};
23 changes: 22 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3204,6 +3204,11 @@ cjs-module-lexer@^1.0.0:
resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz#9f84ba3244a512f3a54e5277e8eef4c489864e40"
integrity sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA==

classnames@^2.2.5:
version "2.3.2"
resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.3.2.tgz#351d813bf0137fcc6a76a16b88208d2560a0d924"
integrity sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw==

clean-css@^5.2.2:
version "5.3.2"
resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-5.3.2.tgz#70ecc7d4d4114921f5d298349ff86a31a9975224"
Expand Down Expand Up @@ -7520,7 +7525,7 @@ prompts@^2.0.1, prompts@^2.4.2:
kleur "^3.0.3"
sisteransi "^1.0.5"

prop-types@^15.7.2, prop-types@^15.8.1:
prop-types@^15.5.8, prop-types@^15.7.2, prop-types@^15.8.1:
version "15.8.1"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5"
integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==
Expand Down Expand Up @@ -7648,6 +7653,13 @@ react-dom@^18.2.0:
loose-envify "^1.1.0"
scheduler "^0.23.0"

react-easy-swipe@^0.0.21:
version "0.0.21"
resolved "https://registry.yarnpkg.com/react-easy-swipe/-/react-easy-swipe-0.0.21.tgz#ce9384d576f7a8529dc2ca377c1bf03920bac8eb"
integrity sha512-OeR2jAxdoqUMHIn/nS9fgreI5hSpgGoL5ezdal4+oO7YSSgJR8ga+PkYGJrSrJ9MKlPcQjMQXnketrD7WNmNsg==
dependencies:
prop-types "^15.5.8"

react-error-overlay@^6.0.11:
version "6.0.11"
resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-6.0.11.tgz#92835de5841c5cf08ba00ddd2d677b6d17ff9adb"
Expand Down Expand Up @@ -7704,6 +7716,15 @@ react-refresh@^0.11.0:
resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.11.0.tgz#77198b944733f0f1f1a90e791de4541f9f074046"
integrity sha512-F27qZr8uUqwhWZboondsPx8tnC3Ct3SxZA3V5WyEvujRyyNv0VYPhoBg1gZ8/MV5tubQp76Trw8lTv9hzRBa+A==

react-responsive-carousel@^3.2.23:
version "3.2.23"
resolved "https://registry.yarnpkg.com/react-responsive-carousel/-/react-responsive-carousel-3.2.23.tgz#4c0016ff54603e604bb5c1f9e7ef2d1eda133f1d"
integrity sha512-pqJLsBaKHWJhw/ItODgbVoziR2z4lpcJg+YwmRlSk4rKH32VE633mAtZZ9kDXjy4wFO+pgUZmDKPsPe1fPmHCg==
dependencies:
classnames "^2.2.5"
prop-types "^15.5.8"
react-easy-swipe "^0.0.21"

react-router-dom@^6.11.2:
version "6.11.2"
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-6.11.2.tgz#324d55750ffe2ecd54ca4ec6b7bc7ab01741f170"
Expand Down

0 comments on commit 9db6ef0

Please sign in to comment.