Skip to content

Commit

Permalink
added contact form
Browse files Browse the repository at this point in the history
  • Loading branch information
Mano-08 committed Feb 19, 2023
2 parents e9b6138 + 1a9ec49 commit 812ceb9
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 51 deletions.
38 changes: 0 additions & 38 deletions components/landing/Landing.js
Original file line number Diff line number Diff line change
@@ -1,38 +0,0 @@
import { Parallax, ParallaxLayer } from "@react-spring/parallax";
import React, { useState } from "react";

export default function Landing() {
return (
<Parallax pages={2} style={{ top: "0", left: "0" }}>
<ParallaxLayer
offset={0}
speed={2.5}
style={{
display: "flex",
justifyContent: "center",
alignItems: "center",
}}
>
<p>Scroll down</p>
</ParallaxLayer>
<ParallaxLayer
offset={1}
speed={2}
style={{ backgroundColor: "#ff6d6d" }}
/>

<ParallaxLayer
offset={1}
speed={0.5}
style={{
display: "flex",
justifyContent: "center",
alignItems: "center",
color: "white",
}}
>
<p>Scroll up</p>
</ParallaxLayer>
</Parallax>
);
}
26 changes: 26 additions & 0 deletions components/landing/Landing.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React, { useEffect, useState } from "react";
export default function Landing(props) {
const [opacity, setOpacity] = useState(props.opacity);

useEffect(() => {
// Define the function that will update the opacity on scroll
function handleScroll() {
const newOpacity = 1 - window.scrollY / window.innerHeight;
setOpacity(newOpacity);
}

// Add the event listener for the scroll event
window.addEventListener("scroll", handleScroll);

// Clean up the event listener when the component unmounts
return () => {
window.removeEventListener("scroll", handleScroll);
};
}, []);

return (

<img src={props.src} alt="My Image" style={{ opacity: opacity ,width:"100vw",marginTop:"0px",paddingTop:"0px",alignContent:"start",justifyContent:"center"}} />

);
}
1 change: 1 addition & 0 deletions components/layout/navbar/Navbar.module.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

#navbar {
width: 100%;
height: 10vh;
Expand Down
25 changes: 25 additions & 0 deletions components/parallax/Parallax.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React, { useState, useEffect } from "react";
// import "./styles.css";

function Parallax() {
const [offset, setOffset] = useState(0);

useEffect(() => {
function handleScroll() {
setOffset(window.pageYOffset);
}

window.addEventListener("scroll", handleScroll);
return () => {
window.removeEventListener("scroll", handleScroll);
};
}, []);

return (
<div className="parallax" style={{ transform: `translateY(${offset * 0.5}px)` }}>

</div>
);
}

export default Parallax;
43 changes: 35 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"dependencies": {
"@next/font": "13.1.6",
"@react-spring/parallax": "^9.6.1",
"aos": "^2.3.4",
"eslint": "8.34.0",
"eslint-config-next": "13.1.6",
"next": "13.1.6",
Expand Down
18 changes: 13 additions & 5 deletions pages/_app.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import "@/styles/globals.css";
import Layout from "../components/layout/Layout";
import Landing from "../components/landing/Landing";
import Parallax from "../components/parallax/Parallax";
import { useState } from "react";

export default function App({ Component, pageProps }) {
return (
<Layout>
{/* <Landing /> */}
<Component {...pageProps} />
</Layout>
<>
<Landing
src="https://gdsc-yonsei.github.io/assets/images/GDSC-Logo.png"
opacity={1}
/>
<Parallax />
<Layout>
<Component {...pageProps} />
</Layout>
</>
);
}

0 comments on commit 812ceb9

Please sign in to comment.