Skip to content

Commit

Permalink
Fixing links and moving about to appropriete place
Browse files Browse the repository at this point in the history
  • Loading branch information
StanislawMalinski committed Mar 27, 2024
1 parent 51603d0 commit e26889c
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 30 deletions.
81 changes: 55 additions & 26 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,67 @@
import { useEffect, useState} from 'react';
import './App.scss'
import User from "./User/User";
import {Link} from "react-router-dom";
import About from './about';

function Content(mode) {
if (mode === 'home') {
return <div>Home</div>
} else if (mode === 'tournaments') {
return <div>Tournaments</div>
} else if (mode === 'games') {
return <div>Games</div>
} else if (mode === 'about') {
return <About/>
} else {
return <div>Home</div>
}

}

function App(props) {
const {mode} = props
const [content, setContent] = useState('home')

useEffect(() => {
setContent(Content(mode))
}, [mode])

function App() {
return (
<div className="app">
<div className="title">
<h1>Bot-Wars</h1>
<div className="login-btns">
<User isLoggedIn={false}/>
<div className='topper'>
<div className="title">
<h1>Bot-Wars</h1>
<div className="login-btns">
<User isLoggedIn={false}/>
</div>
</div>
</div>
<div className="menu-btns">
<div className="menu-btn">
<Link to="index.html">
<button className="btn">Home</button>
</Link>
</div>
<div className="menu-btn">
<Link to="tournaments">
<button className="btn">Tournaments</button>
</Link>
</div>
<div className="menu-btn">
<Link to="games">
<button className="btn">Games</button>
</Link>
</div>
<div className="menu-btn">
<Link to="about">
<button className="btn">About</button>
</Link>
<div className="menu-btns">
<div className="menu-btn">
<Link to="/" replace={true}>
<button className="btn">Home</button>
</Link>
</div>
<div className="menu-btn">
<Link to="/tournaments" replace={true}>
<button className="btn">Tournaments</button>
</Link>
</div>
<div className="menu-btn">
<Link to="/games" replace={true}>
<button className="btn">Games</button>
</Link>
</div>
<div className="menu-btn">
<Link to="/about" replace={true}>
<button className="btn">About</button>
</Link>
</div>
</div>
</div>
<div className="content">
{content}
</div>
</div>
)
}
Expand Down
3 changes: 2 additions & 1 deletion src/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
}

.app {

h1:hover {
cursor: default;
}
Expand Down Expand Up @@ -45,4 +44,6 @@
.login-btn {
width: 100%;
}

height: 100vh;
}
5 changes: 2 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import AddTournamentForm from "./forms/AddTournamentForm";
import EditTournamentForm from "./forms/EditTournamentForm";
import TournamentDetails from "./Tournaments/TournamentDetails";
import ProfileView from "./User/ProfileView/ProfileView";
import About from "./about.js";
import { Provider } from 'react-redux';
import store from './User/store';
import { getListOfTournaments } from './Tournaments/getListOfTournaments';
Expand All @@ -29,7 +28,7 @@ const tournaments = getListOfTournaments();
const router = createBrowserRouter([
{
path: "/",
element: <App/>,
element: <App mode={"home"}/>,
},
{
path: "/player/:id",
Expand Down Expand Up @@ -76,7 +75,7 @@ const router = createBrowserRouter([
},
{
path: "/about",
element: <About/>,
element: <App mode={"about"}/>,
}
]);

Expand Down

0 comments on commit e26889c

Please sign in to comment.