-
Notifications
You must be signed in to change notification settings - Fork 1
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 #264 from boostcampwm-2022/242-feat-튜토리얼-업데이트
FEAT: 튜토리얼 업데이트
- Loading branch information
Showing
12 changed files
with
156 additions
and
934 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
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import { ReactElement, useState, useRef } from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
import { CancelIcon } from './Icons'; | ||
import { PRIMARY_COLORS } from '@util/Constants'; | ||
import Button from '@components/Button'; | ||
import { Dots } from './Dots'; | ||
|
||
import Main from '@images/tutorial/main.mp4'; | ||
import Table from '@images/tutorial/table.mp4'; | ||
import Diagram from '@images/tutorial/diagram.mp4'; | ||
|
||
const videoSrcArray: string[] = [Main, Table, Diagram]; | ||
const titleArray: string[] = ['메인 페이지', '테이블 뷰', '다이어그램 뷰']; | ||
|
||
const Title = styled.h1` | ||
font-family: 'Roboto'; | ||
color: ${PRIMARY_COLORS.red}; | ||
`; | ||
|
||
const StyledOverlay = styled.div` | ||
position: relative; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
flex-direction: column; | ||
background-color: ${PRIMARY_COLORS.white}; | ||
width: 100vw; | ||
height: 100vh; | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
bottom: 0; | ||
right: 0; | ||
z-index: 10; | ||
& > video { | ||
width: 80%; | ||
height: 80%; | ||
} | ||
`; | ||
|
||
const StyledCancelButton = styled(Button)` | ||
position: absolute; | ||
background-color: transparent; | ||
top: 0px; | ||
right: 0px; | ||
`; | ||
|
||
export const TutorialVideo = ({ | ||
setIsOver, | ||
}: { | ||
setIsOver: React.Dispatch<React.SetStateAction<boolean>>; | ||
}): ReactElement => { | ||
const ref = useRef<HTMLVideoElement>(null); | ||
const [currentIndex, setCurrentIndex] = useState(0); | ||
const [duration, setDuration] = useState(0); | ||
|
||
const handleCancel = (): void => { | ||
setIsOver(true); | ||
}; | ||
|
||
const onEnded = (): void => { | ||
setCurrentIndex(currentIndex === videoSrcArray.length - 1 ? 0 : currentIndex + 1); | ||
}; | ||
|
||
const onLoadedMetadata = (): void => { | ||
if (ref.current === null) return; | ||
setDuration(ref.current.duration); | ||
}; | ||
|
||
return ( | ||
<StyledOverlay> | ||
<StyledCancelButton context={<CancelIcon fill={PRIMARY_COLORS.blue} />} onClick={handleCancel} /> | ||
<Title>{titleArray[currentIndex]}</Title> | ||
<video | ||
src={videoSrcArray[currentIndex]} | ||
ref={ref} | ||
onEnded={onEnded} | ||
onLoadedMetadata={onLoadedMetadata} | ||
autoPlay | ||
/> | ||
<Dots slides={videoSrcArray} currentIndex={currentIndex} setCurrentIndex={setCurrentIndex} duration={duration} /> | ||
</StyledOverlay> | ||
); | ||
}; |
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.