Home.js 1.32 KB
Newer Older
김민수's avatar
김민수 committed
1
2
import React from 'react'
import { Link } from 'react-router-dom';
김민수's avatar
김민수 committed
3
import bg from './img_background2.jpg'
김민수's avatar
김민수 committed
4

김민수's avatar
김민수 committed
5

김민수's avatar
김민수 committed
6
7
function Home() {
    return (
김민수's avatar
김민수 committed
8
9
10
        <>
            <div style={{backgroundImage:'url(' + bg + ')', backgroundColor : "grey" ,backgroundSize: "100%"}}>
                <div className="Main"></div>
김민수's avatar
김민수 committed
11

김민수's avatar
김민수 committed
12
13
14
15
16
17
18
19
20
21
22
23
24
25
                <div className="Box">
                    <div className="Name" style ={{color : "white", fontSize :'30px'}}>
                        이름을 입력하세요   
            <input style={{blockSize:'40px', marginLeft:'30px'}} onChange={(event) => sessionStorage.setItem('name', event.target.value)} />
                    </div>

                    {/* sessionStorage를 사용해야는지 localstorage를 사용해야하는지 */}
                </div>

                <div className='Box2'>
                    <Link to="/quiz">
                        <button className="QuizStart" onClick={checking}>Quiz Start !</button>
                    </Link>
                </div>
김민수's avatar
김민수 committed
26
            </div>
김민수's avatar
김민수 committed
27
        </>
김민수's avatar
김민수 committed
28

김민수's avatar
김민수 committed
29
30
    )
}
김민수's avatar
김민수 committed
31
32
33
34
35
36
37
38
39
40
function checking(event) {

    if (sessionStorage.getItem('name') === null || sessionStorage.getItem('name').length === 0) {
        alert('이름을 입력하세요')

    }
    else {
        alert('입력하신 이름은' + sessionStorage.getItem('name') + '입니다.')
    }
}
김민수's avatar
김민수 committed
41

김민수's avatar
김민수 committed
42
export default Home;