Home.js 1.43 KB
Newer Older
baesangjune's avatar
home    
baesangjune committed
1
2
3
import React from 'react'
import { Link } from 'react-router-dom';
import bg from './img_study.jpg'
Jiwon Yoon's avatar
Jiwon Yoon committed
4
5


baesangjune's avatar
baesangjune committed
6
function Home() {
Jiwon Yoon's avatar
Jiwon Yoon committed
7
    return (
baesangjune's avatar
baesangjune committed
8
        <>
baesangjune's avatar
home    
baesangjune committed
9
10
11
12
13
14
15
16
17
18
19
    
            <div style={{ backgroundImage: 'url(' + bg + ')', width:'100%', height:'900%' ,backgroundSize: "100%", backgroundRepeat: 'no-repeat' }}>
                <div style={{ boxAlign: 'center' }} className="Main"></div>

                <div className="Box">
                    <div className="Name" style={{ padding: '10px', fontSize: '40px' }}>
                        이름을 입력하세요
                    <input style={{ marginLeft: '30px', inlineSize: '200px', blockSize: '40px', fontSize: '40px' }} onChange={(event) => sessionStorage.setItem('name', event.target.value)} />
                    </div>

                    {/* sessionStorage를 사용해야는지 localstorage를 사용해야하는지 */}
baesangjune's avatar
baesangjune committed
20
                </div>
baesangjune's avatar
home    
baesangjune committed
21
22
23
24
25

                <div className='Box2'>
                    <Link to="/quiz">
                        <button className="QuizStart" onClick={checking}>Quiz Start !</button>
                    </Link>
baesangjune's avatar
.    
baesangjune committed
26
                </div>
Jiwon Yoon's avatar
Jiwon Yoon committed
27
            </div>
baesangjune's avatar
baesangjune committed
28
        </>
baesangjune's avatar
home    
baesangjune committed
29

Jiwon Yoon's avatar
Jiwon Yoon committed
30
31
    )
}
baesangjune's avatar
home    
baesangjune committed
32
function checking(event) {
baesangjune's avatar
baesangjune committed
33

baesangjune's avatar
home    
baesangjune committed
34
35
    if (sessionStorage.getItem('name') === null || sessionStorage.getItem('name').length === 0) {
        alert('이름을 입력하세요')
baesangjune's avatar
baesangjune committed
36

baesangjune's avatar
home    
baesangjune committed
37
38
39
40
41
    }
    else {
        alert('입력하신 이름은' + sessionStorage.getItem('name') + '입니다.')
    }
}
Jiwon Yoon's avatar
Jiwon Yoon committed
42

baesangjune's avatar
home    
baesangjune committed
43
export default Home;