basic navbar

This commit is contained in:
Parker M. 2024-11-12 23:34:45 -06:00
parent 3b2258877f
commit 47b429e8b1
Signed by: parker
GPG Key ID: 505ED36FC12B5D5E
3 changed files with 100 additions and 60 deletions

View File

@ -1,10 +1,23 @@
import styles from '../styles/Navbar.module.css'; import styles from '../styles/Navbar.module.css';
import { Link } from 'react-router-dom';
function Navbar() { function Navbar() {
return ( return (
<nav className={styles.navbar}> <div className={styles.navbar}>
<span>LinkLogger</span> <div className={styles.navbarLeft}>
</nav> <Link to={'/login'}>
<a className={styles.navbarLink}>Login</a>
</Link>
<Link to={'/signup'}>
<a className={styles.navbarLink}>Signup</a>
</Link>
</div>
<div className={styles.navbarRight}>
<Link to={'/status'}>
<a className={styles.navbarLink}>API Status</a>
</Link>
</div>
</div>
); );
} }

View File

@ -3,6 +3,7 @@ import styles from '../styles/Login.module.css';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import axios from 'axios'; import axios from 'axios';
import Navbar from './Navbar';
function Signup() { function Signup() {
document.title = 'LinkLogger | Signup'; document.title = 'LinkLogger | Signup';
@ -61,52 +62,55 @@ function Signup() {
}; };
return ( return (
<div id={styles.container}> <>
<p id={styles.signupText}>Sign up</p> <Navbar />
<p id={styles.error} className={error ? 'visible' : 'hidden'}> <div id={styles.container}>
{error} <p id={styles.signupText}>Sign up</p>
</p> <p id={styles.error} className={error ? 'visible' : 'hidden'}>
<div> {error}
<header> </p>
<hr></hr> <div>
<form onSubmit={handleSubmit}> <header>
<input <hr></hr>
type="text" <form onSubmit={handleSubmit}>
placeholder="username" <input
value={username} type="text"
onChange={(e) => setUsername(e.target.value)} placeholder="username"
required value={username}
/> onChange={(e) => setUsername(e.target.value)}
<input required
type="password" />
placeholder="password" <input
value={password} type="password"
minLength={8} placeholder="password"
onChange={(e) => setPassword(e.target.value)} value={password}
required minLength={8}
/> onChange={(e) => setPassword(e.target.value)}
<input required
type="password" />
placeholder="confirm password" <input
value={passwordConfirm} type="password"
minLength={8} placeholder="confirm password"
onChange={(e) => setPasswordConfirm(e.target.value)} value={passwordConfirm}
required minLength={8}
/> onChange={(e) => setPasswordConfirm(e.target.value)}
<button type="submit" disabled={isSubmitting}> required
{isSubmitting ? 'Submitting...' : 'Submit'} />
</button> <button type="submit" disabled={isSubmitting}>
</form> {isSubmitting ? 'Submitting...' : 'Submit'}
<hr></hr> </button>
<p id={styles.bottomText}> </form>
Already have an account?{' '} <hr></hr>
<Link to="/login" className={styles.link}> <p id={styles.bottomText}>
Log in here. Already have an account?{' '}
</Link> <Link to="/login" className={styles.link}>
</p> Log in here.
</header> </Link>
</p>
</header>
</div>
</div> </div>
</div> </>
); );
} }

View File

@ -1,18 +1,41 @@
/* Create the nav and center the span */ /* Create the navbar and set the colors */
.navbar { .navbar {
display: flex; display: flex;
justify-content: center; justify-content: space-between;
align-items: center; background-color: #3b4148;
height: 60px; color: white;
background-color: #f8f9fa; padding: 15px;
} }
/* Create the nav links */ .navbarLink {
margin: 0 20px;
span { position: relative;
font-size: 35px; display: inline-block;
font-weight: 600; text-decoration: none;
color: #333; color: #ccc;
text-decoration: none; font-size: 20px;
margin-right: 10px; font-weight: 600;
}
.navbarLink::after {
content: "";
position: absolute;
bottom: 0;
left: 0;
width: 0%;
height: 2px;
background-color: #ccc;
transition: width 0.3s ease;
}
.navbarLink:hover::after {
width: 100%;
}
.navbarLeft {
margin-left: 50px;
}
.navbarRight {
margin-right: 50px;
} }