Admin.js 2.79 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
13
14
15
16
17


    // let QnAadmin = []
    // let Q = []
    // let choose = []
    // let N = []

Jiwon Yoon's avatar
Jiwon Yoon committed
18
19
    const [result, setresult] = useState('')
    // const [addQuiz, setaddQuiz] = useState('')
Jiwon Yoon's avatar
d    
Jiwon Yoon committed
20
    const [QuizBtnCount, setQuizBtnCount] = useState(4)
baesangjune's avatar
baesangjune committed
21

baesangjune's avatar
baesangjune committed
22

Jiwon Yoon's avatar
Jiwon Yoon committed
23
24
    function handleClickSetting() {
        setresult(<AdminSetting />)
baesangjune's avatar
baesangjune committed
25
    }
Jiwon Yoon's avatar
h    
Jiwon Yoon committed
26

Jiwon Yoon's avatar
Jiwon Yoon committed
27
28
    function handleClickQuiz() {
        setresult(<AdminQuiz />)
baesangjune's avatar
baesangjune committed
29
    }
baesangjune's avatar
baesangjune committed
30

Jiwon Yoon's avatar
d    
Jiwon Yoon committed
31
32
33
34
    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
35
        setQuizBtnCount(QuizBtnCount + 1)
Jiwon Yoon's avatar
d    
Jiwon Yoon committed
36
37
    }

Jiwon Yoon's avatar
Jiwon Yoon committed
38
39


baesangjune's avatar
baesangjune committed
40
41
    return (
        <>
Jiwon Yoon's avatar
h    
Jiwon Yoon committed
42
43
44
            <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
45
46
                        <div className="my-5">
                            <h4>관리자페이지</h4>
baesangjune's avatar
baesangjune committed
47
                        </div>
Jiwon Yoon's avatar
d    
Jiwon Yoon committed
48
49
                        <div>
                            <button type="button" className="btn btn-outline-info mb-5" onClick={handleClickSetting}>Setting</button>
baesangjune's avatar
baesangjune committed
50
                        </div>
Jiwon Yoon's avatar
d    
Jiwon Yoon committed
51
52
53
54
55
56
                        <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
57

Jiwon Yoon's avatar
d    
Jiwon Yoon committed
58
                        </div>
Jiwon Yoon's avatar
h    
Jiwon Yoon committed
59
                    </div>
Jiwon Yoon's avatar
d    
Jiwon Yoon committed
60

Jiwon Yoon's avatar
h    
Jiwon Yoon committed
61
62
63
                    <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
64
65
66
                                <div className="row d-flex justify-content-center">
                                </div>
                            </div>
Jiwon Yoon's avatar
Jiwon Yoon committed
67
68
69
                            <div className="text-center mt-5">
                                <h2>관리자 페이지에 오신 것을 환영합니다</h2>
                            </div>
Jiwon Yoon's avatar
Jiwon Yoon committed
70
71
                            {result}

baesangjune's avatar
baesangjune committed
72
                        </div>
Jiwon Yoon's avatar
h    
Jiwon Yoon committed
73
74
75
76
                    </div>
                </div>
            </div>

baesangjune's avatar
admin    
baesangjune committed
77

baesangjune's avatar
baesangjune committed
78
79
80
81
82
        </>
    )
}

export default Admin