Added a header, all links except github only refresh the page. Also added header&footer to App and removed unneccessary login

This commit is contained in:
MisbehavedNinjaRadiator 2025-05-15 18:05:28 +02:00 committed by Luisa Bellitto
parent 312e925c1b
commit 6d1b144d14
4 changed files with 124 additions and 35 deletions

View file

@ -2,45 +2,15 @@ import React, { use } from 'react';
import logo from './logo.svg';
import './App.css';
import { useState, useEffect } from 'react';
import Footer from './Footer';
import Header from './header';
function App() {
const [username, setUsername] = useState<string>('');
const [password, setPassword] = useState<string>('');
const [mail, setMail] = useState<string>('');
const [isCreate, setIsCreate] = useState<boolean>(false);
useEffect(() => {
console.log(username);
}, [username]);
const changeUsername = (event : React.ChangeEvent<HTMLInputElement>) => {
if (event.target.value.length > 20) {
alert("Username is too long");
}
setUsername(event.target.value);
}
const changePassword = (event : React.ChangeEvent<HTMLInputElement>) => {
setPassword(event.target.value);
}
const changeMail = (event : React.ChangeEvent<HTMLInputElement>) => {
setMail(event.target.value);
}
return (
<div className="App">
{isCreate? <h1>Create Account</h1> : <h1>Login</h1> }
{isCreate && <>
<label htmlFor="email">E-Mail</label>
<input id='email' type="email" value={mail} onChange={changeMail}></input>
<br /></>}
<label htmlFor="username">Username</label>
<input id='username' type="text" value={username} onChange={changeUsername}></input>
<br />
<label htmlFor="password">Password</label>
<input id='password' type="password" value={password} onChange={changePassword}/>
<br />
<input type="button" onClick={() => setIsCreate(!isCreate)} value={isCreate? "Create" : "login"}/>
<Header/>
<Footer/>
</div>
);
}

View file

@ -0,0 +1,80 @@
:root {
--Rotkehlchen-gray: #e7ecf2;
--Rotkehlchen-brown1: #a28d7a;
--Rotkehlchen-orange-default: #e79a0e;
}
.footer {
display: flex;
justify-content: space-between;
align-items: center;
background-color: var(--Rotkehlchen-gray);
padding: 1rem 2rem;
}
.footer-left {
display: flex;
flex-direction: column;
gap: 1rem;
}
.footer-link {
display: flex;
align-items: center;
gap: 0.5rem;
color: #000;
font-weight: 500;
text-decoration: none;
}
.footer-link.github img {
width: 20px;
height: 20px;
transform: scale(1.9);
}
.footer-link.feather img {
width: 20px;
height: 20px;
transform: scale(1.5);
}
.footer-link img {
width: 20px;
height: 20px;
object-fit:unset;
vertical-align: middle;
}
.footer-link.feather span {
color: var(--Rotkehlchen-orange-default);
font-weight: bold;
}
.footer-right {
display: flex;
gap: 4rem;
}
.footer-column {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.footer-column a {
color: black;
text-decoration: none;
font-weight: 500;
}
.footer-column a:hover {
text-decoration: underline;
}

View file

@ -0,0 +1,36 @@
import React from "react";
import "./Footer.css";
function Footer() {
return (
<footer className="footer">
<div className="footer-left">
<a href="" className="footer-link feather">
<img src="/assets/icons/feather_black.svg" alt="Feather icon" />
<span>Feather Feed</span>
</a>
<a href="https://github.com" target="_blank " className="footer-link github">
<img src="/assets/icons/github.svg" alt="GitHub icon" />
<span>GitHub</span>
</a>
</div>
<div className="footer-right">
<div className="footer-column">
<a href="">Home</a>
<a href="">About</a>
</div>
<div className="footer-column">
<a href="">Login</a>
<a href="">Sign up</a>
</div>
<div className="footer-column">
<a href="">Create Post</a>
<a href="">Feed</a>
</div>
</div>
</footer>
);
}
export default Footer;