-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Product details slider #44
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3706f7c
created productDetailsSlider
vlevik 0ea7c1f
Merge branch 'master' into productDetailsSlider
vlevik 5fec844
Merge branch 'master' into productDetailsSlider
vlevik f4fa3b5
Merge branch 'master' into productDetailsSlider
vlevik c402d09
Merge branch 'productDetailsSlider' of https://github.com/fe-aug23-te…
vlevik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@import '../../styles/blocks/container'; | ||
|
||
.container { | ||
@extend .container; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,35 @@ | ||
import React from 'react'; | ||
import React, { useEffect, useState } from 'react'; | ||
|
||
// import styles from './ProductDetailsPage.module.scss'; | ||
import styles from './ProductDetailsPage.module.scss'; | ||
|
||
import { Breadcrumbs } from '../shared/Breadcrumbs'; | ||
import { BackButton } from '../shared/BackButton'; | ||
import { ProductDetailsSlider } from './components/ProductDetailsSlider'; | ||
import { PhoneDetail } from '../../types/PhoneDetail'; | ||
import { getPhoneDetail } from '../../api/service'; | ||
// import { ProductSlider } from '../shared/ProductSlider'; | ||
|
||
export const ProductDetailsPage: React.FC = () => { | ||
const [phoneDetails, setPhoneDetails] = useState<PhoneDetail | null>(null); | ||
|
||
useEffect(() => { | ||
getPhoneDetail('apple-iphone-7-32gb-black') | ||
.then(setPhoneDetails); | ||
}, []); | ||
|
||
return ( | ||
<> | ||
<div className={styles.container}> | ||
<Breadcrumbs /> | ||
|
||
<BackButton /> | ||
|
||
<h2>Name of Product</h2> | ||
|
||
<article> | ||
<ProductDetailsSlider /> | ||
<ProductDetailsSlider images={phoneDetails?.images} /> | ||
</article> | ||
|
||
{/* <ProductSlider /> */} | ||
</> | ||
</div> | ||
); | ||
}; |
22 changes: 22 additions & 0 deletions
22
src/modules/ProductDetailsPage/components/ProductDetailsSlider/Arrows.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from 'react'; | ||
import styles from './ProductDetailsSlider.module.scss'; | ||
|
||
export const NextArrow: React.FC = () => { | ||
return ( | ||
<> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need in a fragment component if you have only one child inside |
||
<div | ||
className={styles['slick-next-phone']} | ||
/> | ||
</> | ||
); | ||
}; | ||
|
||
export const PrevArrow: React.FC = () => { | ||
return ( | ||
<> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same story, fragment component is redundant |
||
<div | ||
className={styles['slick-prev-phone']} | ||
/> | ||
</> | ||
); | ||
}; |
30 changes: 30 additions & 0 deletions
30
src/modules/ProductDetailsPage/components/ProductDetailsSlider/BorderColorHandler.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import styles from './ProductDetailsSlider.module.scss'; | ||
|
||
export const getBorderColor = ( | ||
i: number, currentSlide: number, isDarkTheme: boolean, | ||
) => { | ||
let borderColor; | ||
|
||
switch (true) { | ||
case currentSlide === i && isDarkTheme: | ||
borderColor = styles['dots-border-dark-cur']; | ||
break; | ||
|
||
case currentSlide !== i && isDarkTheme: | ||
borderColor = styles['dots-border-dark']; | ||
break; | ||
|
||
case currentSlide === i && !isDarkTheme: | ||
borderColor = styles['dots-border-light-cur']; | ||
break; | ||
|
||
case currentSlide !== i && !isDarkTheme: | ||
borderColor = styles['dots-border-light']; | ||
break; | ||
|
||
default: | ||
break; | ||
} | ||
|
||
return borderColor; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,191 @@ | ||
@import '../../../../styles/utils/mixins/mixin-media'; | ||
|
||
.slick-prev-phone, | ||
.slick-next-phone { | ||
display: none; | ||
visibility: hidden; | ||
} | ||
|
||
#phoneImagesSlider { | ||
.slick-track { | ||
display: flex; | ||
height: 464px !important; | ||
} | ||
} | ||
|
||
.phonePhoto { | ||
@include onMobile { | ||
width: 288px; | ||
height: 288px; | ||
object-fit: contain; | ||
margin-inline: auto; | ||
} | ||
|
||
@include onTablet { | ||
width: 288px; | ||
height: 288px; | ||
object-fit: contain; | ||
} | ||
|
||
@include onDesktop { | ||
width: 464px; | ||
height: 464px; | ||
object-fit: contain; | ||
} | ||
}; | ||
|
||
.slick-dots, | ||
.slick-thumb { | ||
cursor: pointer; | ||
width: auto !important; | ||
|
||
@include onMobile { | ||
height: 40px; | ||
width: 51px; | ||
object-fit: contain; | ||
padding-block: 4px; | ||
} | ||
|
||
@include onTablet { | ||
height: 28px; | ||
width: 28px; | ||
object-fit: contain; | ||
padding-block: 4px; | ||
} | ||
|
||
@include onDesktop { | ||
height: 67px; | ||
width: 67px; | ||
object-fit: contain; | ||
padding: 4px; | ||
} | ||
} | ||
|
||
#phone-photo { | ||
width: auto !important; | ||
height: 464px !important; | ||
img { | ||
width: auto !important; | ||
} | ||
} | ||
|
||
.vertical-dots { | ||
ul { | ||
display: flex !important; | ||
flex-direction: column; | ||
margin-right: 16px; | ||
width: auto !important; | ||
margin-top: 0 !important; | ||
|
||
@include onMobile { | ||
flex-direction: row; | ||
margin-right: 0px; | ||
justify-content: center; | ||
margin-top: 16px !important; | ||
} | ||
|
||
@include onTablet { | ||
:last-child { | ||
margin-bottom: 0px; | ||
} | ||
} | ||
|
||
@include onDesktop { | ||
:last-child { | ||
margin-bottom: 0px; | ||
} | ||
} | ||
|
||
li { | ||
width: 79px; | ||
height: 79px; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
|
||
@include onTablet { | ||
width: 34px; | ||
height: 34px; | ||
} | ||
|
||
@include onDesktop { | ||
width: 79px; | ||
height: 79px; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
@include onMobile { | ||
width: 48px; | ||
height: 48px; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
a { | ||
width: 100%; | ||
height: 100%; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
} | ||
} | ||
|
||
li { | ||
|
||
@include onMobile { | ||
width: 51px !important; | ||
margin-right: 8px; | ||
} | ||
|
||
@include onTablet { | ||
margin-bottom: 8px; | ||
} | ||
|
||
@include onDesktop { | ||
margin-bottom: 16px; | ||
} | ||
} | ||
|
||
@include onTablet { | ||
display: flex; | ||
flex-direction: row-reverse; | ||
margin-right: 16px; | ||
cursor: pointer; | ||
} | ||
|
||
@include onDesktop { | ||
display: flex; | ||
flex-direction: row-reverse; | ||
cursor: pointer; | ||
margin-right: 16px; | ||
} | ||
} | ||
|
||
.dots-container { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
.dots-border-light-cur { | ||
border: 1px solid #0F0F11; | ||
border-radius: 4px; | ||
} | ||
|
||
.dots-border-light { | ||
border: 1px solid #E2E6E9; | ||
border-radius: 4px; | ||
} | ||
|
||
.dots-border-dark { | ||
border: 1px solid #3b3e4a; | ||
border-radius: 4px; | ||
} | ||
|
||
.dots-border-dark-cur { | ||
border: 1px solid #f1f2f9; | ||
border-radius: 4px; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dont forget to remove it if you don't need it)