Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start content higher on landing page #16

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 45 additions & 46 deletions src/Landing.css
Original file line number Diff line number Diff line change
@@ -1,69 +1,68 @@
.Landing {
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-family: "HalisR-Regular";
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-family: "HalisR-Regular";
}

.Landing-header {
top: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
z-index: 0;
top: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
z-index: 0;
}

.Landing-head-img {
top: 0;
width: 100vw;
height: auto;
position: fixed;
z-index: 0;
top: 0;
width: 100vw;
height: auto;
position: fixed;
z-index: 0;
}

.Landing-nav {
width: 100%;
height: 5rem;
margin: calc(100vw * 2048 / 2890) 0 0 0;
padding: 0;
display: flex;
flex-direction: column;
justify-content: center;
background-color: white;
filter: drop-shadow(0 3px 3px darkgray);
z-index: 1;
text-align: left;
width: 100%;
height: 5rem;
padding: 0;
display: flex;
flex-direction: column;
justify-content: center;
background-color: white;
filter: drop-shadow(0 3px 3px darkgray);
z-index: 1;
text-align: left;
}

.Landing-nav h3 {
padding-left: 1rem;
padding-left: 1rem;
}

.Landing-body {
width: 100%;
padding-top: 5%;
display: flex;
justify-content: center;
background-color: #D3F0EF;
z-index: 1;
width: 100%;
padding-top: 5%;
display: flex;
justify-content: center;
background-color: #D3F0EF;
z-index: 1;
}

.Landing-container {
max-width: 961px;
width: 75%;
display: flex;
flex-direction: column;
align-items: flex-start;
justify-self: center;
z-index: 1;
max-width: 961px;
width: 75%;
display: flex;
flex-direction: column;
align-items: flex-start;
justify-self: center;
z-index: 1;
}

.Landing-section {
text-align: left;
margin-bottom: 5%;
flex-direction: column;
justify-content: left;
text-align: left;
margin-bottom: 5%;
flex-direction: column;
justify-content: left;
}
30 changes: 29 additions & 1 deletion src/Landing.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {useLayoutEffect, useState, useEffect, useRef} from 'react'
import './index.css';
import './Landing.css';
import Card from './Card.js';
Expand Down Expand Up @@ -198,17 +199,44 @@ const guideContent = (
</div>
);

function useWindowSize() {
const [size, setSize] = useState([0, 0]);
useLayoutEffect(() => {
function updateSize() {
setSize([window.innerWidth, window.innerHeight]);
}
window.addEventListener('resize', updateSize);
updateSize();
return () => window.removeEventListener('resize', updateSize);
}, []);
return size;
}

function Landing() {
const inital = useRef(true);
const imgRef = useRef();
const [navMargin, setNavMargin] = useState(0);
const [width, height] = useWindowSize();

const onImgLoad = ({ target:img }) => {
//5rem = 80px
console.log(height)
console.log(img.clientHeight)
setNavMargin(img.clientHeight < height ? img.clientHeight : (height - 80))
}

return (
<div className="Landing">
<header className="Landing-header">
<img
ref={imgRef}
src="/landing-page.png"
className="Landing-head-img"
alt="landing"
onLoad={onImgLoad}
/>
</header>
<nav className="Landing-nav">
<nav className="Landing-nav" style={{marginTop: navMargin}}>
<h3>PennApps Mentoring</h3>
</nav>
<div className="Landing-body">
Expand Down