Home.js 1.61 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
0    
baesangjune committed
9
10
            <div style={{ backgroundImage: 'url(' + bg + ')', backgroundColor: "grey", backgroundSize: "100%", width: "100%", height: "880px", backgroundRepeat:'no-repeat' }}>
                {/* <div className="Main"></div> */}
baesangjune's avatar
home    
baesangjune committed
11
12

                <div className="Box">
baesangjune's avatar
0    
baesangjune committed
13
                    <div className="Name" style={{ fontSize: '30px', position: "absolute", top: "330px", left: "38%"}}>
baesangjune's avatar
home    
baesangjune committed
14
                        이름을 입력하세요
baesangjune's avatar
0805    
baesangjune committed
15
                        <input style={{ marginLeft: '30px', inlineSize: '200px', blockSize: '40px', fontSize: '40px' }} onChange={(event) => localStorage.setItem('name', event.target.value)} />
baesangjune's avatar
0    
baesangjune committed
16
17
18
19
20
                        <div className='Box2'>
                            <Link to="/quiz">
                                <button style={{marginTop:'35%',blockSize:'100px', inlineSize:'200px', fontSize:'35px' }} className="QuizStart" onClick={checking}>Quiz Start !</button>
                            </Link>
                        </div>
baesangjune's avatar
home    
baesangjune committed
21
                    </div>
baesangjune's avatar
0805    
baesangjune committed
22
                    {/* localStorage를 사용해야는지 localstorage를 사용해야하는지 */}
baesangjune's avatar
baesangjune committed
23
                </div>
baesangjune's avatar
home    
baesangjune committed
24

baesangjune's avatar
0    
baesangjune committed
25
26
27
                <div>계산수학</div>


Jiwon Yoon's avatar
Jiwon Yoon committed
28
            </div>
baesangjune's avatar
baesangjune committed
29
        </>
baesangjune's avatar
home    
baesangjune committed
30

Jiwon Yoon's avatar
Jiwon Yoon committed
31
32
    )
}
baesangjune's avatar
0    
baesangjune committed
33
function checking() {
baesangjune's avatar
baesangjune committed
34

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

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

baesangjune's avatar
0    
baesangjune committed
44
export default Home;