Commit befc7fe2 authored by baesangjune's avatar baesangjune
Browse files

.

parent 1dd02a47
import React from 'react'; import React from 'react';
import './App.css';
import Home from './Home' import Home from './Home'
import Quiz from './Quiz' import Quiz from './Quiz'
import End from './End' import End from './End'
...@@ -10,13 +9,12 @@ import { BrowserRouter as Router, Link, Switch, Route, Redirect } from 'react-ro ...@@ -10,13 +9,12 @@ import { BrowserRouter as Router, Link, Switch, Route, Redirect } from 'react-ro
function App() { function App() {
return ( return (
<Router> <Router>
<header> <div className="container-fluid vh-100 bg-light">
<Link to="/"> <header className="border-bottom">
<button>Calculus</button> <Link to="/">
</Link> <button className="ml-3 btn btn-light btn-lg font-weight-bold text-dark">Home</button>
</header> </Link>
<hr /> </header>
<div>
<Switch> <Switch>
<Route exact path="/" component={Home} /> <Route exact path="/" component={Home} />
......
import React, { useState } from 'react'; import React from 'react';
import AdminQuiz from './AdminQuiz' // import './App.css';
import AdminSetting from './AdminSetting' import Home from './Home'
import Quiz from './Quiz'
let QuizBtn=[] import End from './End'
import Admin from './Admin'
function Admin() {
import { BrowserRouter as Router, Link, Switch, Route, Redirect } from 'react-router-dom';
const [result, setresult] = useState('')
const [QuizBtnCount, setQuizBtnCount] = useState(4) function App() {
return (
function handleClickSetting() { <Router>
setresult(<AdminSetting />) <div className="container-fluid vh-100 bg-light">
} <header className="border-bottom">
<Link to="/">
function handleClickQuiz(e) { <button className="ml-3 btn btn-light btn-lg font-weight-bold text-dark">Home</button>
setresult(<AdminQuiz QuizNum={e.target.id} data={JSON.parse(localStorage.getItem('QnA'))} />) </Link>
} </header>
<Switch>
function handleClickAddQuiz() { <Route exact path="/" component={Home} />
QuizBtn.push(
<button type='button' className='btn btn-outline-primary' id={QuizBtnCount} onClick={handleClickQuiz}>Quiz {QuizBtnCount}</button> <Route path="/quiz" component={Quiz} />
)
setQuizBtnCount(QuizBtnCount + 1) <Route path="/end" component={End} />
}
<Route path="/admin" component={Admin} />
return (
<> <Redirect path="/admin" to="/admin" />
<div className="container-fluid"> </Switch>
<div className="row justify-content-md-center mt-5"> </div>
<div className="col-2 text-center border py-5"> </Router>
<div className="mb-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>
</div>
</div>
<div className="col-8 ">
{result}
</div>
</div>
</div>
</>
)
} }
export default Admin
\ No newline at end of file export default App;
\ No newline at end of file
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