Commit 5f3cac18 authored by baesangjune's avatar baesangjune
Browse files

check

parent 7306d873
...@@ -17,7 +17,7 @@ function Home() { ...@@ -17,7 +17,7 @@ function Home() {
<div className='Box2'> <div className='Box2'>
<Link to="/quiz"> <Link to="/quiz">
<button className="QuizStart">Quiz Start !</button> <button className="QuizStart" onClick={checking}>Quiz Start !</button>
</Link> </Link>
</div> </div>
</> </>
...@@ -26,7 +26,7 @@ function Home() { ...@@ -26,7 +26,7 @@ function Home() {
} }
function checking(event) { function checking(event) {
if (sessionStorage.getItem('name') === null||'') { if (sessionStorage.getItem('name') === null||sessionStorage.getItem('name').length ===0) {
alert('이름을 입력하세요') alert('이름을 입력하세요')
// alert('입력하신 이름은'+event.target+'입니다.') // alert('입력하신 이름은'+event.target+'입니다.')
......
...@@ -13,6 +13,7 @@ class Quiz extends React.Component { ...@@ -13,6 +13,7 @@ class Quiz extends React.Component {
super(props) super(props)
this.setQuestion = this.setQuestion.bind(this) this.setQuestion = this.setQuestion.bind(this)
this.answerbox = this.answerbox.bind(this) this.answerbox = this.answerbox.bind(this)
this.timer=this.timer.bind(this)
// this.enterkey = this.enterkey(this) // this.enterkey = this.enterkey(this)
this.state = { this.state = {
...question[0], ...question[0],
...@@ -40,6 +41,27 @@ class Quiz extends React.Component { ...@@ -40,6 +41,27 @@ class Quiz extends React.Component {
} }
} }
} }
timer(){
return(
<Timer
initialTime={10010}
direction="backward"
checkpoints={[
{
time: 0,
callback: this.setQuestion
// history.go(1)
}
]}
>
{() => (
<>
<Timer.Seconds /> seconds
</>
)}
</Timer> /* npm i react-compound-timer */
)
}
// enterkey() { // enterkey() {
// if ( window.event === 13 ) { // if ( window.event === 13 ) {
// alert("Enter Key 입력 감지 \n함수 실행."); // alert("Enter Key 입력 감지 \n함수 실행.");
...@@ -71,23 +93,7 @@ class Quiz extends React.Component { ...@@ -71,23 +93,7 @@ class Quiz extends React.Component {
} }
{/* <input onKeyPress="this.enterkey()"/> */} {/* <input onKeyPress="this.enterkey()"/> */}
<Timer {this.timer()}
initialTime={5000}
direction="backward"
checkpoints={[
{
time: 0,
callback: () => console.log('콜백실행')
// history.go(1)
}
]}
>
{() => (
<>
<Timer.Seconds /> seconds
</>
)}
</Timer> {/* npm i react-compound-timer */}
</div> </div>
) )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment