forked from bodyBudy/bodyBuddy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/trainer-feat' into develop
- Loading branch information
Showing
10 changed files
with
370 additions
and
49 deletions.
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,34 @@ | ||
import styled from '@emotion/styled'; | ||
|
||
interface ButtonProps { | ||
onClick: () => void; | ||
role: string; | ||
} | ||
|
||
const Button = ({ onClick, role }: ButtonProps) => { | ||
const StyledButton = styled.button` | ||
position: absolute; | ||
top: 50%; | ||
right: ${(props) => props.role === 'next' && '0px'}; | ||
transform: translateY(-50%); | ||
width: 20px; | ||
cursor: pointer; | ||
z-index: 10; | ||
`; | ||
|
||
return ( | ||
<StyledButton onClick={onClick} role={role} aria-label={role === 'prev' ? '이전' : '다음'}> | ||
{role === 'prev' ? ( | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 512"> | ||
<path d="M192 448c-8.188 0-16.38-3.125-22.62-9.375l-160-160c-12.5-12.5-12.5-32.75 0-45.25l160-160c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25L77.25 256l137.4 137.4c12.5 12.5 12.5 32.75 0 45.25C208.4 444.9 200.2 448 192 448z" /> | ||
</svg> | ||
) : ( | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 512"> | ||
<path d="M64 448c-8.188 0-16.38-3.125-22.62-9.375c-12.5-12.5-12.5-32.75 0-45.25L178.8 256L41.38 118.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0l160 160c12.5 12.5 12.5 32.75 0 45.25l-160 160C80.38 444.9 72.19 448 64 448z" /> | ||
</svg> | ||
)} | ||
</StyledButton> | ||
); | ||
}; | ||
|
||
export default Button; |
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,73 @@ | ||
import styled from '@emotion/styled'; | ||
import Image from 'next/image'; | ||
import { useState } from 'react'; | ||
import Slider from 'react-slick'; | ||
import 'slick-carousel/slick/slick.css'; | ||
import 'slick-carousel/slick/slick-theme.css'; | ||
import Button from './Button'; | ||
|
||
export const TrainerImages = ({ images, onClickSetModal, initialslider }: TrainerModalProps) => { | ||
const Background = styled.div` | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 390px; | ||
height: 100vh; | ||
z-index: 1; | ||
background-color: rgba(0, 0, 0, 0.5); | ||
`; | ||
|
||
const ImageModal = styled.article` | ||
box-sizing: border-box; | ||
background-color: #fff; | ||
width: 350px; | ||
height: 400px; | ||
position: absolute; | ||
z-index: 10; | ||
top: 200px; | ||
left: 20px; | ||
padding: 10px; | ||
`; | ||
|
||
const CloseButton = styled.button` | ||
position: absolute; | ||
top: 5px; | ||
right: 5px; | ||
width: 30px; | ||
height: 30px; | ||
font-size: 20px; | ||
font-weight: 700; | ||
cursor: pointer; | ||
background-color: white; | ||
border-radius: 50%; | ||
z-index: 20; | ||
`; | ||
|
||
const settings = { | ||
dots: true, | ||
infinite: true, | ||
speed: 500, | ||
slidesToShow: 1, | ||
slidesToScroll: 1, | ||
initialSlide: initialslider, | ||
nextArrow: <Button role="next" onClick={() => {}} />, | ||
prevArrow: <Button role="prev" onClick={() => {}} />, | ||
}; | ||
|
||
return ( | ||
<Background> | ||
<ImageModal> | ||
<CloseButton onClick={() => onClickSetModal((state: boolean) => !state)}>X</CloseButton> | ||
<section> | ||
<Slider {...settings}> | ||
{images.map((image: string, index: number) => ( | ||
<div key={index}> | ||
<Image src={image} title={'강사 사진'} alt={'강사 사진'} width={350} height={350} /> | ||
</div> | ||
))} | ||
</Slider> | ||
</section> | ||
</ImageModal> | ||
</Background> | ||
); | ||
}; |
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
Oops, something went wrong.