Skip to content

Commit d82b978

Browse files
user search products
1 parent 234b59a commit d82b978

File tree

4 files changed

+24
-97
lines changed

4 files changed

+24
-97
lines changed

src/assets/styles/Search.scss

+4-83
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
height: 10rem;
99
font-size: 1.5rem;
1010
padding: 5rem;
11-
border-bottom: $fourth-color;
11+
border-bottom: 2px solid rgba(119, 119, 119, 0.49);
1212

1313
.product-name{
1414
font-size: 2rem;
@@ -67,94 +67,15 @@
6767
margin-top: 20rem;
6868
}
6969
.noResult{
70+
margin: 0 auto;
7071
display: flex;
7172
flex-direction: column;
72-
margin-left: 35%;
73-
margin-top: 2vh;
7473
img{
75-
width: 400px;
74+
width: auto;
7675
height: 400px;
7776
}
7877
}
7978
}
8079

8180

82-
}
83-
84-
// .product-search {
85-
// display: flex;
86-
// flex-direction: column;
87-
// height: 65px;
88-
// background-color: $container-color;
89-
// border-bottom: 1px solid #ccc;
90-
91-
// .main-content-product {
92-
// display: flex;
93-
// flex-direction: column;
94-
// .upper-side {
95-
// display: flex;
96-
// margin-left: 50px;
97-
// margin-right: 50px;
98-
// height: 40px;
99-
// }
100-
101-
// .searchPrice-box {
102-
// display: flex;
103-
// align-items: center;
104-
// width: 80rem;
105-
// height: 56px;
106-
// padding-top: 10px;
107-
// padding-bottom: 10px;
108-
// line-height: 40px;
109-
// margin-left: 5px;
110-
111-
// &:not(:last-child) {
112-
// margin-bottom: 10px;
113-
// }
114-
115-
// .product-name {
116-
// font-size: 20px;
117-
// margin-right: 10px;
118-
// width: 30rem;
119-
// }
120-
121-
// .searchSpan-price {
122-
// margin: 0 6px 0 4px;
123-
// line-height: 30px;
124-
// font-size: 20px;
125-
// vertical-align: middle;
126-
// display: inline-block;
127-
// }
128-
129-
// .dropdown-container {
130-
// display: flex;
131-
// align-items: center;
132-
133-
// .min-span,
134-
// .max-span,
135-
// .discount-span {
136-
// display: flex;
137-
// align-items: center;
138-
// justify-content: space-between;
139-
// width: 100px;
140-
// height: 30px;
141-
// border: 1px solid rgba(255, 109, 24, 0.49);
142-
// border-radius: 4px;
143-
// padding: 0 5px;
144-
// font-size: 15px;
145-
// cursor: pointer;
146-
// margin-right: 10px;
147-
// }
148-
// .header__selected__iconIcon {
149-
// margin-left: 8px;
150-
// color:rgba(255, 109, 24, 0.49);
151-
// }
152-
153-
// }
154-
// }
155-
// }
156-
// }
157-
// .product-main{
158-
// height: 500px;
159-
// background-color: $container-color;
160-
// }
81+
}

src/pages/Search.tsx

+11-11
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { useLocation, useNavigate } from "react-router-dom";
66
import noresults from "../../public/assets/images/noResult.png"
77
import Product from "../components/product/Product";
88
import { searchProduct } from "../store/features/product/productSlice";
9+
import { PuffLoader } from "react-spinners";
910

1011
const SearchBar: React.FC = () => {
1112
const location = useLocation();
@@ -116,20 +117,19 @@ const SearchBar: React.FC = () => {
116117
</div>
117118
<div className="product-main">
118119
{isLoading ? (
119-
<div className="loader-spinner">
120-
<SkewLoader color={"#FF6D18"} loading={isLoading} size={100} />
121-
</div>
120+
<div className="loader">
121+
<PuffLoader color="#ff6d18" size={300} loading={isLoading} />
122+
</div>
122123
) : isSuccess && filteredProduct ? (
123124
<div className="product-list">
124125
<Product
125-
key={filteredProduct.id}
126-
images={filteredProduct.images}
127-
name={filteredProduct.name}
128-
price={`$${filteredProduct.price}`}
129-
stock={Number(filteredProduct.quantity)}
130-
description={filteredProduct.description}
131-
discount={Number(filteredProduct.discount.replace("%", ""))}
132-
/>
126+
key={filteredProduct.id}
127+
images={filteredProduct.images}
128+
name={filteredProduct.name}
129+
price={`$${filteredProduct.price}`}
130+
stock={Number(filteredProduct.quantity)}
131+
description={filteredProduct.description}
132+
discount={Number(filteredProduct.discount.replace("%", ""))} id={""} />
133133
</div>
134134
) : isError ? (
135135
<div className="error-message">

src/pages/SendResetPasswordLink.tsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable */
2-
import React, { useEffect } from 'react'
2+
import React, { useEffect ,useState} from 'react'
33
import { useFormik } from 'formik';
44
import { useAppDispatch, useAppSelector } from '../store/store';
55
import { sendResetLink } from '../store/features/auth/authSlice';
@@ -11,6 +11,7 @@ const ResetPasswordSchema = Yup.object().shape({
1111
email: Yup.string().email('Email must be valid').required('Email is required'),
1212
})
1313
const SendResetPasswordLink: React.FC = () => {
14+
const [hideParagraph, setHideParagraph] = useState(true);
1415
const dispatch = useAppDispatch();
1516
const { user, isError, isSuccess, isLoading, message } = useAppSelector((state) => state?.auth);
1617
const formik = useFormik({
@@ -35,6 +36,7 @@ const SendResetPasswordLink: React.FC = () => {
3536
if (isSuccess) {
3637
toast.success(message)
3738
formik.resetForm()
39+
setHideParagraph(false);
3840
}
3941
}, [isError, isSuccess, message]);
4042

@@ -61,7 +63,11 @@ const SendResetPasswordLink: React.FC = () => {
6163
/>
6264
<label className="input-label" id="email" htmlFor="email">Email Address</label>
6365
</div>
64-
<p className='error'>{formik.status}</p><br /><br />
66+
{hideParagraph ? (
67+
<>
68+
<p className='error'>{formik.status}</p><br />
69+
</>
70+
): null}
6571
<button
6672
className={`reset-Button${isLoading ? " loading" : ""}`}
6773
disabled={isLoading}

src/store/features/product/productService.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const productService = {
4141
fetchProducts,
4242
fetchSingleProduct,
4343
fetchProductReviews,
44-
fetchShopInfo
44+
fetchShopInfo,
4545
searchProduct
4646
}
4747
export default productService;

0 commit comments

Comments
 (0)