Commit c5d07de9 authored by Jiwon Yoon's avatar Jiwon Yoon
Browse files

d

parent f850026b
import React, { useState } from 'react';
import Quiz from './Quiz';
// import { Link } from 'react-router-dom';
let list = []
let QuizBtn = []
function Admin() {
......@@ -21,8 +23,8 @@ function Admin() {
const [time, setTime] = useState('')
const [addQuiz, setaddQuiz] = useState('')
const [selectOption, setselectOption] = useState(1)
const [QuizBtnCount, setQuizBtnCount] = useState(4)
const [done, setDone] = useState(false)
const handleChangeQuestion = (event) => {
......@@ -44,6 +46,9 @@ function Admin() {
setTime(event.target.value)
}
function handleClickSetting(){
}
function handleClick() {
......@@ -55,7 +60,6 @@ function Admin() {
localStorage.setItem('AP', adminpassword)
localStorage.setItem('T', time * 1000)
setDone(true)
}
......@@ -64,7 +68,7 @@ function Admin() {
<div className="input-group">
<div className="input-group-prepend">
<div className="input-group-text">
<input type="radio" id={selectOption+1} name="answer" />
<input type="radio" id={selectOption + 1} name="answer" />
</div>
</div>
<input type="text" class="form-control" placeholder="보기를 입력하세요" onChange={handleChangeChoose} />
......@@ -80,35 +84,36 @@ function Admin() {
setaddQuiz(addQuiz)
}
function handleClickAddQuiz() {
QuizBtn.push(
<button type="button" className="btn btn-outline-primary" id={QuizBtnCount} onClick={handleClickQuiz}>Quiz {QuizBtnCount}</button>
)
setQuizBtnCount(QuizBtnCount+1)
}
return (
<>
{done ? alert('모두 입력되었습니다.') : ''}
<div className="container-fluid">
<div className="row justify-content-md-center mt-5 ">
<div className="col-2 text-center border">
<div className="navbar-header p-3 ">
<p className="navbar-brand border-bottom ">관리자 페이지</p>
<div className="my-5">
<h4>관리자페이지</h4>
</div>
<div className="nav flex-column nav-pills" id="v-pills-tab" role="tablist">
<p className="navbar-text border-bottom">관리자 설정 변경하기</p>
<a className="nav-link" id="setting-tab" data-toggle='pill' href="#setting" role="tab">Setting</a>
<p className="navbar-text border-bottom">Quiz 입력하기</p>
<a className="nav-link" id="Quiz1-tab" data-toggle="pill" href="#Quiz1" role="tab" >Quiz1</a>
<a className="nav-link" id="Quiz2-tab" data-toggle="pill" href="#Quiz2" role="tab" >Quiz2</a>
<a className="nav-link" id="Quiz3-tab" data-toggle="pill" href="#Quiz3" role="tab" >Quiz3</a>
{addQuiz}
<button className="btn btn-danger navbar-btn" onClick={handleClickQuiz} >Quiz 추가</button>
<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>
</div>
</div>
<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">
......@@ -138,36 +143,33 @@ function Admin() {
<div className="" id="Quiz1">
<div className="container">
<h2 className="p-3 border text-center">문제만들기</h2>
<div className="p-3 borber">
<div className="p-3 ">
<span className="font-weight-bold mr-2 h3">1.</span>
{/* <input type="text" onChange={handleChangenumber} placeholder="Number" /> */}
<input type="text" className="form-control" onChange={handleChangeQuestion} placeholder="문제를 입력하세요" />
</div>
<div className="p-3 ">
<div className="input-group">
<div className="input-group-prepend">
<div className="input-group-text">
<input type="radio" id={selectOption} name="answer" />
</div>
<h2 className="p-3 border text-center">문제만들기</h2>
<div className="p-3 borber">
<div className="p-3 ">
<span className="font-weight-bold mr-2 h3">1.</span>
<input type="text" className="form-control" onChange={handleChangeQuestion} placeholder="문제를 입력하세요" />
</div>
<div className="p-3 ">
<div className="input-group">
<div className="input-group-prepend">
<div className="input-group-text">
<input type="radio" id={selectOption} name="answer" />
</div>
<input type="text" className="form-control" placeholder="보기를 입력하세요" onChange={handleChangeChoose} />
</div>
{list.map((element)=>element)}
<button className="btn btn-outline-secondary btn-sm" onClick={addSelectOption}>+</button>
</div>
<div className="p-3 ">
<span className="font-weight-bold mr-2 h3">정답:</span>
<input type="text" onChange={handleChangeanswer} placeholder="정답을 입력하세요" />
<input type="text" className="form-control" placeholder="보기를 입력하세요" onChange={handleChangeChoose} />
</div>
{list.map((element) => element)}
<button className="btn btn-outline-secondary btn-sm" onClick={addSelectOption}>+</button>
</div>
<label for="inputLogin" className="d-flex justify-content-center">
<button className="mt-4 btn btn-dark" onClick={handleClick}>작성완료</button>
</label>
<div className="p-3 ">
<span className="font-weight-bold mr-2 h3">정답:</span>
<input type="text" onChange={handleChangeanswer} placeholder="정답을 입력하세요" />
</div>
<label for="inputLogin" className="d-flex justify-content-center">
<button className="mt-4 btn btn-dark" onClick={handleClick}>작성완료</button>
</label>
</div>
</div>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment