-
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.
Feat: Tutorial 및 Block Tab Menu 생성
- Loading branch information
Showing
10 changed files
with
295 additions
and
9 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,67 @@ | ||
import { useState } from "react"; | ||
|
||
import Button from "./Button"; | ||
|
||
import { | ||
ModalBackground, | ||
ModalContainer, | ||
ModalContent, | ||
} from "../../style/ModalStyle"; | ||
import { Header, ButtonContainer } from "../../style/CommonStyle"; | ||
import { ImageContainer, ContentContainer } from "../../style/TutorialStyle"; | ||
|
||
const TutorialModal = ({ title, tutorials, onClose }) => { | ||
const [currentIndex, setCurrentIndex] = useState(0); | ||
|
||
const handleNextButton = () => { | ||
if (currentIndex < tutorials.length - 1) { | ||
setCurrentIndex(currentIndex + 1); | ||
} else { | ||
onClose(); | ||
} | ||
}; | ||
|
||
const handlePreviousButton = () => { | ||
if (currentIndex > 0) { | ||
setCurrentIndex(currentIndex - 1); | ||
} | ||
}; | ||
|
||
const currentTutorial = tutorials[currentIndex]; | ||
|
||
return ( | ||
<ModalBackground> | ||
<ModalContainer> | ||
<Header> | ||
<h2>{title}</h2> | ||
</Header> | ||
<ModalContent> | ||
<ImageContainer> | ||
<img | ||
src={currentTutorial.image} | ||
alt={`Tutorial step ${currentIndex + 1}`} | ||
/> | ||
</ImageContainer> | ||
<ContentContainer> | ||
{currentTutorial.content.split(".").join(".\n")} | ||
</ContentContainer> | ||
<ButtonContainer> | ||
<Button | ||
type="text" | ||
text="prev" | ||
handleClick={handlePreviousButton} | ||
disabled={currentIndex === 0} | ||
/> | ||
<Button | ||
type="text" | ||
text={currentIndex === tutorials.length - 1 ? "start" : "next"} | ||
handleClick={handleNextButton} | ||
/> | ||
</ButtonContainer> | ||
</ModalContent> | ||
</ModalContainer> | ||
</ModalBackground> | ||
); | ||
}; | ||
|
||
export default TutorialModal; |
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,20 @@ | ||
import styled from "styled-components"; | ||
|
||
const ImageContainer = styled.div` | ||
display: flex; | ||
gap: 4rem; | ||
width: 50rem; | ||
height: 20rem; | ||
img { | ||
width: 50rem; | ||
} | ||
`; | ||
|
||
const ContentContainer = styled.pre` | ||
display: flex; | ||
line-height: 2rem; | ||
font-weight: bold; | ||
`; | ||
|
||
export { ImageContainer, ContentContainer }; |