Skip to content

Commit

Permalink
Merge pull request #21 from wethmiranasinghe/main
Browse files Browse the repository at this point in the history
Update Login.jsx
  • Loading branch information
wethmiranasinghe authored Jun 17, 2024
2 parents e21e272 + fb047ca commit 1d833e6
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 9 deletions.
2 changes: 2 additions & 0 deletions front-end/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Footer from "./components/Footer";
import './components/Header.css'
// import './components/Footer.css'

import Login from './Pages/Login';
import Home from './Pages/Home';
import Team from './Pages/Team';
import News from './Pages/News';
Expand All @@ -25,6 +26,7 @@ function App() {
<BrowserRouter>
<nav> <Header/> </nav>
<Routes>
<Route path = 'login' element = {<Login />} />
<Route path = '/' element = {<Home />} />
<Route path = 'project overview' element = {<SharedLayoutProjectOverview />}>
<Route index element = {<SharedLayoutProjectOverview />}/>
Expand Down
9 changes: 9 additions & 0 deletions front-end/src/Pages/Login.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function Login() {
return(
<>
<h1>Login</h1>
</>
);
}

export default Login;
13 changes: 6 additions & 7 deletions front-end/src/components/Header.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
color-scheme: light dark;
color: rgba(0, 0, 0, 0.87);
background-color: #ffffff;

text-decoration: none;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
Expand All @@ -20,11 +20,11 @@
a {
font-weight: 600;
font-size: 0.9em;
color: #646cff;
text-decoration: inherit;
color: white;
text-decoration: none;
}
a:hover {
color: #535bf2;
color: white;
}

h1 {
Expand All @@ -46,7 +46,7 @@
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 20px;
margin-top: 40px;
padding: 0px 0px;
margin-bottom: 0px;
box-sizing: border-box;
Expand Down Expand Up @@ -181,9 +181,8 @@
}

a {
font-weight: 500;
font-weight: 600;
font-size: 0.8em;
color: #646cff;
text-decoration: inherit;
}

Expand Down
24 changes: 22 additions & 2 deletions front-end/src/components/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,40 @@
import React, {useState} from 'react';
import {Link, Outlet} from 'react-router-dom'; // //Add page routing using router dom
import React, {useState, useEffect} from 'react';
import {Link, Outlet, useLocation} from 'react-router-dom'; // //Add page routing using router dom

import cylcleLogo from '../assets/CYCLE-logo.png';
import erasmusLogo from '../assets/erasmus-plus-logo.jpg';
import style from '../pageStyling/Login.module.css';

function Header(){
// Constants for hamburger menu
const [menuOpen, setMenuOpen] = useState(false);

// Constants for login button
const [isVisible, setIsVisible] = useState(true);

// Get the current location
const location = useLocation();

// set hamburger menu to close when a link is clicked
const handleLinkClick = () => {
setMenuOpen(false);
setIsVisible(false);
}

// Update the visibility of the login button based on the current location
useEffect(() => {
if (location.pathname === '/login') {
setIsVisible(false);
} else {
setIsVisible(true);
}
})

return(
<header>
<div>
{isVisible && <button className={style["Login-button"]}><Link to = '/login' onClick={handleLinkClick}>LOGIN</Link></button>}
</div>
<div className='logo-block'>
{/* Erasmus logo */}
<a href = "https://erasmus-plus.ec.europa.eu/"><img src={erasmusLogo} alt="Erasmus+ Logo" className="Erasmus-plus-Logo"></img></a>
Expand Down
20 changes: 20 additions & 0 deletions front-end/src/pageStyling/Login.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.Login-button{
position: absolute;
display: flex;
align-self: flex-start;
top: 30px;
right: 30px;
padding: 10px 22px;
font-size: 16px;
background-color: #203a90;
text-decoration: none;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.2s ease;
}

.Login-button:hover {
background-color: #0056b3;
}

0 comments on commit 1d833e6

Please sign in to comment.