Admin.js 2.32 KB
Newer Older
baesangjune's avatar
baesangjune committed
1
import React, { useState } from 'react';
Jiwon Yoon's avatar
a    
Jiwon Yoon committed
2
import AdminQuiz from './AdminQuiz'
Jiwon Yoon's avatar
Jiwon Yoon committed
3
import AdminSetting from './AdminSetting'
baesangjune's avatar
baesangjune committed
4

Jiwon Yoon's avatar
h    
Jiwon Yoon committed
5

Jiwon Yoon's avatar
a    
Jiwon Yoon committed
6
let QuizBtn=[]
Jiwon Yoon's avatar
h    
Jiwon Yoon committed
7

baesangjune's avatar
baesangjune committed
8
function Admin() {
baesangjune's avatar
baesangjune committed
9

Jiwon Yoon's avatar
a    
Jiwon Yoon committed
10
11
    const[result, setresult] = useState('')
    const[QuizBtnCount, setQuizBtnCount] = useState(4)
baesangjune's avatar
baesangjune committed
12

Jiwon Yoon's avatar
a    
Jiwon Yoon committed
13
14
    function handleClickSetting(){
        setresult(<AdminSetting/>)
baesangjune's avatar
baesangjune committed
15
    }
Jiwon Yoon's avatar
h    
Jiwon Yoon committed
16

Jiwon Yoon's avatar
a    
Jiwon Yoon committed
17
18
    function handleClickQuiz(){
        setresult(<AdminQuiz/>)
baesangjune's avatar
baesangjune committed
19
    }
Jiwon Yoon's avatar
a    
Jiwon Yoon committed
20
21
22
23
    
    function handleClickAddQuiz(){
        QuizBtnCount.push(
            <button type='button' className='btn btn-outline-primary' id={QuizBtnCount} onClick={handleClickQuiz}>Quiz {QuizBtnCount}</button>
Jiwon Yoon's avatar
d    
Jiwon Yoon committed
24
        )
Jiwon Yoon's avatar
a    
Jiwon Yoon committed
25
        setQuizBtnCount(QuizBtnCount+1)
Jiwon Yoon's avatar
d    
Jiwon Yoon committed
26
27
    }

baesangjune's avatar
baesangjune committed
28
29
    return (
        <>
Jiwon Yoon's avatar
a    
Jiwon Yoon committed
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
        <div className="container-fluid">
            <div className="row justify-content-md-center mt-5 ">
                <div className="col-2 text-center border">
                    <div className="my-5">
                        <h4>관리자페이지</h4>
                    </div>
                    <div>
                        <button type="button" className="btn btn-outline-info mb-5" onClick={handleClickSetting}>Setting</button>
                    </div>
                    <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
45

Jiwon Yoon's avatar
h    
Jiwon Yoon committed
46
                    </div>
Jiwon Yoon's avatar
a    
Jiwon Yoon committed
47
                </div>
Jiwon Yoon's avatar
d    
Jiwon Yoon committed
48

Jiwon Yoon's avatar
a    
Jiwon Yoon committed
49
50
51
52
                <div className="col-8">
                    <div className="tab-content" id="v-pills-tabContent">
                        <div className="tab-pane fade show active" id="setting" role="tabpanel" >
                            <div className="row d-flex justify-content-center">
baesangjune's avatar
baesangjune committed
53
                            </div>
baesangjune's avatar
baesangjune committed
54
                        </div>
Jiwon Yoon's avatar
a    
Jiwon Yoon committed
55
56
57
            
                        {result}

Jiwon Yoon's avatar
h    
Jiwon Yoon committed
58
59
60
                    </div>
                </div>
            </div>
Jiwon Yoon's avatar
a    
Jiwon Yoon committed
61
        </div>
Jiwon Yoon's avatar
h    
Jiwon Yoon committed
62

baesangjune's avatar
admin    
baesangjune committed
63

Jiwon Yoon's avatar
a    
Jiwon Yoon committed
64
    </>
baesangjune's avatar
baesangjune committed
65
66
67
68
    )
}

export default Admin