-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
137 additions
and
75 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,97 @@ | ||
*{ | ||
* { | ||
box-sizing: border-box; | ||
} | ||
|
||
body{ | ||
body { | ||
margin: 0; | ||
} | ||
|
||
.site-title{ | ||
.site-title { | ||
font-size: 4rem; | ||
|
||
} | ||
|
||
.header-nav{ | ||
border-left: #E4F2E7; | ||
.header-nav { | ||
border-left: #e4f2e7; | ||
border-left-style: solid; | ||
margin: 4rem; | ||
width: calc(100% - 15rem); /* adjust the width of the header-nav element to make room for the logout button */ | ||
} | ||
.header{ | ||
background-color: #2D3E40; | ||
color: #E4F2E7; | ||
|
||
.header { | ||
background-color: #2d3e40; | ||
color: #e4f2e7; | ||
display: flex; | ||
gap: 2rem; | ||
padding-left: 1rem; | ||
padding-right: 1rem; | ||
position: relative; /* add this */ | ||
} | ||
|
||
|
||
.site-title:hover{ | ||
color: #E4F2E7; | ||
.site-title:hover { | ||
color: #e4f2e7; | ||
} | ||
|
||
.header a{ | ||
color: #E4F2E7; | ||
.header a { | ||
color: #e4f2e7; | ||
text-decoration: none; | ||
|
||
height: 100%; | ||
display: flex; | ||
align-items: center; | ||
padding: .25rem; | ||
padding: 0.25rem; | ||
padding-top: 1.5rem; | ||
padding-bottom: 1.5rem; | ||
} | ||
|
||
.header-item:hover{ | ||
color: #2D3E40; | ||
background-color: #E4F2E7; | ||
.header-item:hover { | ||
color: #2d3e40; | ||
background-color: #e4f2e7; | ||
} | ||
|
||
.header ul{ | ||
.header ul { | ||
padding-left: 1rem; | ||
margin: 0; | ||
list-style: none; | ||
display: flex; | ||
gap: 1rem; | ||
} | ||
|
||
.header li:active{ | ||
background-color: #E4F2E7; | ||
color: #2D3E40; | ||
.header li:active { | ||
background-color: #e4f2e7; | ||
color: #2d3e40; | ||
} | ||
|
||
.logout-btn { | ||
position: absolute; | ||
right: 10px; | ||
top: 50%; | ||
transform: translateY(-50%); | ||
font-size: 1rem; | ||
padding: 0.25rem; | ||
padding-top: 1.5rem; | ||
padding-bottom: 1.5rem; | ||
color: #e4f2e7; | ||
background-color: transparent; | ||
border: none; | ||
cursor: pointer; | ||
} | ||
|
||
.logout-btn:hover { | ||
color: #2d3e40; | ||
background-color: #e4f2e7; | ||
height: 100%; | ||
} | ||
|
||
.username { | ||
position: absolute; | ||
right: 100px; | ||
top: 50%; | ||
transform: translateY(-50%); | ||
font-size: 1rem; | ||
padding: 0.25rem; | ||
padding-top: 1.5rem; | ||
padding-bottom: 1.5rem; | ||
color: #e4f2e7; | ||
background-color: transparent; | ||
border: none; | ||
cursor: pointer; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,44 @@ | ||
import useWindowDimensions from "../hooks/WindowDimensionsHook.tsx"; | ||
import "../assets/css/Header.css" | ||
import {Link} from "react-router-dom"; | ||
import {auth} from "../utils/firebase.ts"; | ||
|
||
interface Props { | ||
user?: string | ||
user?: string; | ||
children?: React.ReactNode; | ||
} | ||
|
||
export function Header({user} : Props) { | ||
const {width, height} = useWindowDimensions(); | ||
const aspect_ratio = (width == 0 ? 1 : width) / (height == 0 ? 1 : height); | ||
export function Header({ user }: Props) { | ||
const { width, height } = useWindowDimensions(); | ||
const aspect_ratio = (width == 0? 1 : width) / (height == 0? 1 : height); | ||
const use_narrow = aspect_ratio < 0.7; | ||
|
||
return <header className="header"> | ||
|
||
{/*App Name reloads home page*/} | ||
<a href="/" className="site-title"> | ||
<h3>{use_narrow ? "B-19" : "Budget-19"}</h3> | ||
</a> | ||
|
||
{/*Pages*/} | ||
<ul className="header-nav"> | ||
|
||
{/*Links to dashboard with tiles*/} | ||
<li><Link to="/dash" className="header-item">Dashboard</Link></li> | ||
|
||
{/*Links to transactions page with table of expenses*/} | ||
<li><Link to="/transactions" className="header-item">Transactions</Link></li> | ||
|
||
<li><Link to="/test" className="header-item">Firestore Test</Link></li> | ||
|
||
<li>{user}</li> | ||
</ul> | ||
</header>; | ||
const currentUser = auth.currentUser?.displayName?? ""; | ||
|
||
return ( | ||
<header className="header"> | ||
{/* App Name reloads home page */} | ||
<a href="/" className="site-title"> | ||
<h3>{use_narrow? "B-19" : "Budget-19"}</h3> | ||
</a> | ||
|
||
{/* Pages */} | ||
<ul className="header-nav"> | ||
{/* Links to dashboard with tiles */} | ||
<li><Link to="/dash" className="header-item">Dashboard</Link></li> | ||
|
||
{/* Links to transactions page with table of expenses */} | ||
<li><Link to="/transactions" className="header-item">Transactions</Link></li> | ||
|
||
<li><Link to="/test" className="header-item">Firestore Test</Link></li> | ||
|
||
{user && ( | ||
<li> | ||
<span className="username">{currentUser}</span> | ||
<button type="button" className="logout-btn">Logout</button> | ||
</li> | ||
)} | ||
</ul> | ||
</header> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters