Admin.js 2.52 KB
Newer Older
baesangjune's avatar
baesangjune committed
1
import React, { useState } from 'react';
Jiwon Yoon's avatar
Jiwon Yoon committed
2
3
import AdminQuiz from './AdminQuiz';
import AdminSetting from './AdminSetting'
baesangjune's avatar
baesangjune committed
4
5
// import { Link } from 'react-router-dom';

Jiwon Yoon's avatar
h    
Jiwon Yoon committed
6

Jiwon Yoon's avatar
Jiwon Yoon committed
7

Jiwon Yoon's avatar
d    
Jiwon Yoon committed
8
let QuizBtn = []
Jiwon Yoon's avatar
h    
Jiwon Yoon committed
9

baesangjune's avatar
baesangjune committed
10
function Admin() {
baesangjune's avatar
baesangjune committed
11
12


Jiwon Yoon's avatar
Jiwon Yoon committed
13
14
    const [result, setresult] = useState('')
    // const [addQuiz, setaddQuiz] = useState('')
Jiwon Yoon's avatar
d    
Jiwon Yoon committed
15
    const [QuizBtnCount, setQuizBtnCount] = useState(4)
baesangjune's avatar
baesangjune committed
16

baesangjune's avatar
baesangjune committed
17

Jiwon Yoon's avatar
Jiwon Yoon committed
18
19
    function handleClickSetting() {
        setresult(<AdminSetting />)
baesangjune's avatar
baesangjune committed
20
    }
Jiwon Yoon's avatar
h    
Jiwon Yoon committed
21

Jiwon Yoon's avatar
Jiwon Yoon committed
22
23
    function handleClickQuiz() {
        setresult(<AdminQuiz />)
baesangjune's avatar
baesangjune committed
24
    }
baesangjune's avatar
baesangjune committed
25

Jiwon Yoon's avatar
d    
Jiwon Yoon committed
26
27
28
29
    function handleClickAddQuiz() {
        QuizBtn.push(
            <button type="button" className="btn btn-outline-primary" id={QuizBtnCount} onClick={handleClickQuiz}>Quiz {QuizBtnCount}</button>
        )
Jiwon Yoon's avatar
Jiwon Yoon committed
30
        setQuizBtnCount(QuizBtnCount + 1)
Jiwon Yoon's avatar
d    
Jiwon Yoon committed
31
32
    }

baesangjune's avatar
baesangjune committed
33
34
    return (
        <>
Jiwon Yoon's avatar
h    
Jiwon Yoon committed
35
36
37
            <div className="container-fluid">
                <div className="row justify-content-md-center mt-5 ">
                    <div className="col-2 text-center border">
Jiwon Yoon's avatar
d    
Jiwon Yoon committed
38
39
                        <div className="my-5">
                            <h4>관리자페이지</h4>
baesangjune's avatar
baesangjune committed
40
                        </div>
Jiwon Yoon's avatar
d    
Jiwon Yoon committed
41
42
                        <div>
                            <button type="button" className="btn btn-outline-info mb-5" onClick={handleClickSetting}>Setting</button>
baesangjune's avatar
baesangjune committed
43
                        </div>
Jiwon Yoon's avatar
d    
Jiwon Yoon committed
44
45
46
47
48
49
                        <div class="btn-group-vertical">
                            <button type="button" className="btn btn-outline-primary" id="1" onClick={handleClickQuiz}>Quiz 1</button>
                            <button type="button" className="btn btn-outline-primary" id="2" onClick={handleClickQuiz}>Quiz 2</button>
                            <button type="button" className="btn btn-outline-primary" id="3" onClick={handleClickQuiz}>Quiz 3</button>
                            {QuizBtn.map((element) => element)}
                            <button type="button" className="btn btn-outline-primary" onClick={handleClickAddQuiz}>+</button>
baesangjune's avatar
baesangjune committed
50

Jiwon Yoon's avatar
d    
Jiwon Yoon committed
51
                        </div>
Jiwon Yoon's avatar
h    
Jiwon Yoon committed
52
                    </div>
Jiwon Yoon's avatar
d    
Jiwon Yoon committed
53

Jiwon Yoon's avatar
h    
Jiwon Yoon committed
54
55
56
                    <div className="col-8">
                        <div className="tab-content" id="v-pills-tabContent">
                            <div className="tab-pane fade show active" id="setting" role="tabpanel" >
baesangjune's avatar
baesangjune committed
57
58
59
                                <div className="row d-flex justify-content-center">
                                </div>
                            </div>
Jiwon Yoon's avatar
q    
Jiwon Yoon committed
60

Jiwon Yoon's avatar
Jiwon Yoon committed
61
62
                            {result}

baesangjune's avatar
baesangjune committed
63
                        </div>
Jiwon Yoon's avatar
h    
Jiwon Yoon committed
64
65
66
67
                    </div>
                </div>
            </div>

baesangjune's avatar
admin    
baesangjune committed
68

baesangjune's avatar
baesangjune committed
69
70
71
72
73
        </>
    )
}

export default Admin