Skip to content

Commit 2e2ac98

Browse files
added-stylings
1 parent bc1bfdd commit 2e2ac98

File tree

5 files changed

+28
-17
lines changed

5 files changed

+28
-17
lines changed

public/assets/images/user.png

12.1 KB
Loading

src/App.scss

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@
1414
@import './assets/styles/Sidebar.scss';
1515
@import './assets/styles/Header.scss';
1616
@import "./assets/styles/Product.scss";
17-
@import "./assets/styles/Loader.scss"
17+
@import "./assets/styles/Loader.scss";
18+
@import "./assets/styles/SingleProduct.scss";

src/assets/styles/SingleProduct.scss

+21-10
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
.images-container {
1818
display: flex;
19-
flex: 0 0 60%;
19+
flex: 0 0 60%;
2020
flex-direction: row;
2121
align-items: center;
2222
width: 100%;
@@ -37,16 +37,18 @@
3737
object-fit: cover;
3838
border: 2px solid transparent;
3939
cursor: pointer;
40-
&:hover{
40+
41+
&:hover {
4142
border: 2px solid $primary-color;
4243
}
4344
}
44-
.active{
45+
46+
.active {
4547
border: 2px solid $primary-color;
4648
}
47-
49+
4850
}
49-
51+
5052
.main-image-container {
5153
flex: 1;
5254
overflow: hidden;
@@ -56,7 +58,7 @@
5658
align-items: center;
5759
box-shadow: 0 0 2px #f60;
5860
border-radius: 10px;
59-
61+
6062

6163
.main-image {
6264
width: 100%;
@@ -240,16 +242,17 @@
240242
align-items: center;
241243
justify-content: start;
242244
gap: 2rem;
243-
245+
244246
.img-holder {
247+
padding: 3px;
245248
display: flex;
246249
justify-content: center;
247250
align-items: center;
248251
border-radius: 50%;
249252
overflow: hidden;
250253
width: 30px;
251254
height: 30px;
252-
background-color: #f60;
255+
background-color: $primary-color;
253256

254257
img {
255258
width: 100%;
@@ -306,7 +309,8 @@
306309
overflow: hidden;
307310
width: 30px;
308311
height: 30px;
309-
background-color: #f60;
312+
background-color: $primary-color;
313+
padding: 3px;
310314

311315
img {
312316
width: 100%;
@@ -409,15 +413,22 @@
409413
justify-content: space-between;
410414
width: 100%;
411415
height: 80px;
412-
.thumbnail-image{
416+
417+
.thumbnail-image {
413418
width: 70px;
414419
height: 70px;
415420
}
416421
}
417422

418423
.main-image-container {
424+
min-width: 100%;
425+
max-width: 100%;
426+
max-height: 400px;
427+
min-height: 400px;
428+
419429
.main-image {
420430
height: 100%;
431+
width: 100%;
421432
}
422433
}
423434
}

src/components/product/SingleProduct.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { IProductInitialResponse } from '../../utils/types/store';
1111
import { Meta } from '../Meta';
1212
import { Link } from 'react-router-dom';
1313
import truncateString from '../../utils/text/truncateString';
14+
import UserDefaultImage from "../../../public/assets/images/user.png";
1415

1516
const ProductComponent = ({ productId }: { productId: string }) => {
1617
const dispatch = useAppDispatch();
@@ -124,7 +125,7 @@ const DetailsCard = ({ children, title }: { children: React.ReactNode, title: st
124125
const SellerInfoCard = ({ shop }: { shop: IShop | null }) => {
125126
return (
126127
<div className='seller-info'>
127-
<div className="seller-profile"><div className="img-holder"><img src={shop && shop.image || 'https://placehold.co/100x100'} alt="Shop" /> </div><span>{shop && shop.name}</span></div>
128+
<div className="seller-profile"><div className="img-holder"><img src={shop && shop.image || UserDefaultImage} alt="Shop" /> </div><span>{shop && shop.name}</span></div>
128129
<div className="seller-description">{shop && shop.description}</div>
129130
</div>
130131
)
@@ -148,7 +149,7 @@ const ReviewsCard = ({ reviews }: { reviews: IProductReview[] | null }) => {
148149
const SingleReviewCard = ({ review }: { review: IProductReview }) => {
149150
return (
150151
<div className='review-card'>
151-
<div className="reviewer-profile"><div className="img-holder"><img src={review.user?.profilePicture || 'https://placehold.co/100x100'} alt="Shop" /> </div><span>{`${review.user?.firstName} ${' '} ${review.user?.lastName} `} </span></div>
152+
<div className="reviewer-profile"><div className="img-holder"><img src={review.user?.profilePicture || UserDefaultImage} alt="Shop" /> </div><span>{`${review.user?.firstName} ${' '} ${review.user?.lastName} `} </span></div>
152153
<div className="review-contents">
153154
<div className="stars-container"><StarsRender count={review.rating} /></div>
154155
<div className="review-date">Reviewed on {new Date(review.createdAt).toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' })}</div>

src/store/features/product/singleProductSlice.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,10 @@ const singleProductSlice = createSlice({
3232
state.isError = null;
3333
state.isSuccess = false;
3434
})
35-
// .addCase(fetchSingleProduct.fulfilled, (state, action: PayloadAction<IProductResponse>) => {
36-
.addCase(fetchSingleProduct.fulfilled, (state, action: PayloadAction<any>) => {
35+
.addCase(fetchSingleProduct.fulfilled, (state, action: PayloadAction<IProductResponse>) => {
3736
state.isLoading = false;
3837
state.isSuccess = true;
39-
// state.product = action.payload.data?.product || null;
40-
state.product = action.payload.product || null;
38+
state.product = action.payload.data?.product || null;
4139
})
4240
.addCase(fetchSingleProduct.rejected, (state, action: PayloadAction<any>) => {
4341
state.isLoading = false;

0 commit comments

Comments
 (0)