-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from Strong-Potato/27-feat-create-detail-page-…
…main-swiper Feat: create main swiper
- Loading branch information
Showing
22 changed files
with
452 additions
and
193 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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
File renamed without changes.
File renamed without changes.
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
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
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
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,38 @@ | ||
.container { | ||
width: 100%; | ||
|
||
// 비율 3:2 조절 | ||
aspect-ratio: 3 / 2; | ||
|
||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
|
||
background-color: #efefef; | ||
|
||
position: relative; | ||
|
||
&:hover { | ||
button { | ||
visibility: visible; | ||
} | ||
} | ||
|
||
&__swiperSlide { | ||
text-align: center; | ||
font-size: 18px; | ||
background: #fff; | ||
|
||
/* Center slide text vertically */ | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
img { | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
} | ||
} |
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,45 @@ | ||
import { useState } from "react"; | ||
import { Swiper, SwiperSlide } from "swiper/react"; | ||
// Import Swiper styles | ||
import "swiper/css"; | ||
import "swiper/css/navigation"; | ||
import "swiper/css/pagination"; | ||
import "swiper/css/scrollbar"; | ||
|
||
import styles from "./Swiper.module.scss"; | ||
|
||
import SwiperButton from "./SwiperButton/SwiperButton"; | ||
import SwiperIndex from "./SwiperIndex/SwiperIndex"; | ||
|
||
const image = | ||
"https://m.eejmall.com/web/product/big/201708/211_shop1_627935.jpg"; | ||
|
||
function ImageSwiper() { | ||
const images = new Array(6).fill(image); | ||
const [imageIndex, setImageIndex] = useState<number>(1); | ||
|
||
return ( | ||
<Swiper | ||
pagination={{ | ||
type: "fraction", | ||
}} | ||
className={styles.container} | ||
onActiveIndexChange={(swiper) => { | ||
setImageIndex(swiper.activeIndex + 1); | ||
}} | ||
> | ||
{images.map((data) => ( | ||
<SwiperSlide className={styles.container__swiperSlide}> | ||
<img src={data} alt="#" /> | ||
</SwiperSlide> | ||
))} | ||
<SwiperButton | ||
imageIndex={imageIndex} | ||
imageLength={images.length} | ||
/> | ||
<SwiperIndex imageIndex={imageIndex} imageLength={images.length} /> | ||
</Swiper> | ||
); | ||
} | ||
|
||
export default ImageSwiper; |
52 changes: 52 additions & 0 deletions
52
src/components/Detail/Main/ImageSwiper/SwiperButton/SwiperButton.module.scss
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,52 @@ | ||
.container { | ||
position: absolute; | ||
width: 100%; | ||
top: 50%; | ||
transform: translate(0, -50%); | ||
|
||
display: flex; | ||
justify-content: space-between; | ||
|
||
z-index: 2; | ||
|
||
&__prevBtn { | ||
visibility: hidden; | ||
|
||
position: absolute; | ||
top: 50%; | ||
left: 10px; | ||
transform: translate(0, -50%); | ||
|
||
width: 2.4rem; | ||
height: 2.2rem; | ||
border-radius: 1.2rem; | ||
|
||
background-color: #ffffff; | ||
z-index: 2; | ||
} | ||
|
||
&__nextBtn { | ||
visibility: hidden; | ||
|
||
width: 40px; | ||
|
||
position: absolute; | ||
top: 50%; | ||
right: 10px; | ||
transform: translate(0, -50%); | ||
|
||
width: 2.4rem; | ||
height: 2.2rem; | ||
border-radius: 1.2rem; | ||
|
||
background-color: #ffffff; | ||
z-index: 2; | ||
} | ||
|
||
&__icon { | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
} | ||
} |
Oops, something went wrong.