Skip to content

Commit 5593252

Browse files
committed
Dots removed
1 parent adcc838 commit 5593252

File tree

4 files changed

+30
-6
lines changed

4 files changed

+30
-6
lines changed

src/components/Header.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export default function Header() {
129129

130130
<form className="hidden lg:flex">
131131
<input
132-
className="border-primary-light border px-2 py-1 focus:border-secondary focus:outline-none focus:transition-all "
132+
className="border border-primary-light px-2 py-1 focus:border-secondary focus:outline-none focus:transition-all "
133133
type="text"
134134
placeholder="Search"
135135
/>

src/main.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import App from "./App";
44
import "./index.css";
55
import "react-toastify/dist/ReactToastify.css";
66
import { ToastContainer } from "react-toastify";
7+
import 'react-loading-skeleton/dist/skeleton.css'
78

89
ReactDOM.createRoot(document.getElementById("root")).render(
910
<React.StrictMode>

src/pages/Home.jsx

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,22 @@ import Slider from "react-slick";
55
import Products from "../pages/Products";
66
import axios from "axios";
77
import React, { useEffect, useState } from "react";
8+
import Skeleton from "react-loading-skeleton";
89

910
export default function Home() {
11+
const [isLoading, setIsLoading] = useState(true);
12+
1013
const settings = {
1114
dots: true,
1215
infinite: true,
1316
slidesToShow: 1,
1417
slidesToScroll: 1,
15-
autoplay: true,
18+
autoplay: false,
1619
autoplaySpeed: 2000,
1720
pauseOnHover: true,
1821
initialSlide: 0,
1922
arrows: false,
23+
dots:false,
2024
responsive: [
2125
{
2226
breakpoint: 1024,
@@ -68,14 +72,15 @@ export default function Home() {
6872
.then((res) => {
6973
console.log(res);
7074
setProducts(res.data.data);
71-
isLoading(false);
75+
setIsLoading(false);
7276
})
7377
.catch((err) => {});
7478
}, []);
7579

7680
return (
7781
<>
7882
<Slider {...settings}>
83+
{isLoading && <Skeleton className="h-[576px]" />}
7984
{banners.map((el) => {
8085
return (
8186
<Banner
@@ -92,8 +97,27 @@ export default function Home() {
9297

9398
<div className="container grid gap-4 py-[116px] sm:py-[130px] md:grid-cols-2 md:py-[148px] lg:grid-cols-4 lg:py-[166px] xl:py-[188px] xxl:py-[210px]">
9499
{products.map((el) => {
95-
return <Products name={el.name} price={el.price} image={el.image} />;
100+
return (
101+
<>
102+
<Products
103+
key={el._id}
104+
id={el._id}
105+
name={el.name}
106+
price={el.price}
107+
image={el.image}
108+
/>
109+
</>
110+
);
96111
})}
112+
{isLoading && (
113+
<>
114+
<Skeleton className="h-[250px]" />
115+
<Skeleton className="h-[250px]" />
116+
<Skeleton className="h-[250px]" />
117+
<Skeleton className="h-[250px]" />
118+
</>
119+
)}
120+
{!isLoading && products.length == 0 && <>no product found</>}
97121
</div>
98122
</>
99123
);

src/pages/Products.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import React from "react";
22
import { FaCartPlus } from "react-icons/fa";
3-
import BreadCrumb from "../components/BreadCrumb";
43

54
export default function Products(props) {
65
return (
76
<>
8-
<div className=" bg-primary-light group relative shadow-[0px_0px_25px_0px_rgba(0,0,0,0.1)] ">
7+
<div className=" group relative bg-primary-light shadow-[0px_0px_25px_0px_rgba(0,0,0,0.1)] ">
98
<div className=" absolute left-[11px] top-[11px] hidden h-[30px] w-[30px] items-center justify-center rounded-full border border-primary transition-all group-hover:flex">
109
<FaCartPlus className="text-primary" />
1110
</div>

0 commit comments

Comments
 (0)