mirror of
https://github.com/FranP-code/Hangman-game-with-React.git
synced 2025-10-13 00:42:32 +00:00
Admin place started
This commit is contained in:
11
src/components/Admin/Header/AdminHeader.jsx
Normal file
11
src/components/Admin/Header/AdminHeader.jsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import React from 'react'
|
||||
|
||||
const AdminHeader = () => {
|
||||
return (
|
||||
<header>
|
||||
<h1>Admin Place</h1>
|
||||
</header>
|
||||
)
|
||||
}
|
||||
|
||||
export default AdminHeader
|
||||
41
src/components/Admin/Identify/Form/Form.jsx
Normal file
41
src/components/Admin/Identify/Form/Form.jsx
Normal file
@@ -0,0 +1,41 @@
|
||||
import React from 'react'
|
||||
|
||||
const Form = () => {
|
||||
|
||||
const [option, setOption] = React.useState('login')
|
||||
|
||||
return (
|
||||
<div className="form-container">
|
||||
<nav className="options-container">
|
||||
<div className={option === 'login' ? "active login" : 'login'} onClick={() => setOption('login')}>
|
||||
LOGIN
|
||||
</div>
|
||||
<div className={option === 'register' ? "active register" : 'register'} onClick={() => setOption('register')}>
|
||||
REGISTER
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
{
|
||||
option === 'login' ?
|
||||
|
||||
<form>
|
||||
<input type="email" placeholder="Email"/>
|
||||
<input type="password" placeholder="Password"/>
|
||||
<input type="submit" value="Login" />
|
||||
</form>
|
||||
|
||||
: //saasasasasas
|
||||
|
||||
<form>
|
||||
<input type="email" placeholder="Email"/>
|
||||
<input type="password" placeholder="Password"/>
|
||||
<input type="password" placeholder="Confirm Password" value=""/>
|
||||
<input type="password" placeholder="Admin Reffer Code"/>
|
||||
<input type="submit" value="Register"/>
|
||||
</form>
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Form
|
||||
24
src/components/Admin/Identify/Identify.jsx
Normal file
24
src/components/Admin/Identify/Identify.jsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import React from 'react'
|
||||
import { getAuth, onAuthStateChanged } from "firebase/auth";
|
||||
import Form from './Form/Form'
|
||||
import {withRouter} from 'react-router'
|
||||
|
||||
|
||||
const Identify = (props) => {
|
||||
|
||||
const auth = getAuth()
|
||||
|
||||
onAuthStateChanged(auth, (user) => {
|
||||
|
||||
if (user) {
|
||||
props.history.push('/admin-place')
|
||||
}
|
||||
})
|
||||
|
||||
return (
|
||||
<Form />
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
export default withRouter(Identify)
|
||||
@@ -1,6 +1,8 @@
|
||||
import React, {useState} from 'react'
|
||||
import {withRouter} from "react-router-dom"
|
||||
|
||||
const Header = ({language, category, displayCategories, setDisplayCategories}) => {
|
||||
|
||||
const AppHeader = ({language, category, displayCategories, setDisplayCategories, history}) => {
|
||||
|
||||
const [title, setTitle] = useState('')
|
||||
const [categoryText, setCategoryText] = useState('')
|
||||
@@ -43,8 +45,11 @@ const Header = ({language, category, displayCategories, setDisplayCategories}) =
|
||||
>
|
||||
{categoryText}
|
||||
</h2>
|
||||
<button className='identify-button' onClick={() => history.push('/identify')}>
|
||||
Admin Place
|
||||
</button>
|
||||
</header>
|
||||
)
|
||||
}
|
||||
|
||||
export default Header
|
||||
export default withRouter(AppHeader)
|
||||
Reference in New Issue
Block a user