-
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
1 parent
cde89c7
commit 919d46e
Showing
9 changed files
with
127 additions
and
28 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { useEffect, useState } from "react"; | ||
|
||
import * as React from "react" | ||
import Navbar from "./Navbar" | ||
|
||
const NavbarWrapper: React.FC<React.PropsWithChildren<{}>> = (props) => { | ||
const [isTransparent, setIsTransparent] = useState(true); | ||
useEffect(() => { | ||
const handleScroll = () => { | ||
const location = window.scrollY; | ||
const show = location < 100; | ||
if (show) { | ||
setIsTransparent(true); | ||
} else { | ||
setIsTransparent(false); | ||
} | ||
}; | ||
handleScroll() | ||
document.addEventListener("scroll", handleScroll); | ||
}, []); | ||
|
||
return ( | ||
<div className={"relative"}> | ||
<Navbar | ||
transparent={isTransparent} | ||
/> | ||
<div className={"z-1"}> | ||
{props.children} | ||
</div> | ||
</div> | ||
); | ||
} | ||
export default NavbarWrapper |
27 changes: 27 additions & 0 deletions
27
src/components/landing/intro/Navbar/hooks/get-window-dimensions.ts
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { useState, useEffect } from "react"; | ||
|
||
export const getWindowDimensions = (): { [key: string]: number } => { | ||
const { innerWidth: width, innerHeight: height } = window; | ||
return { | ||
width, | ||
height, | ||
}; | ||
}; | ||
|
||
export const useWindowDimensions = () => { | ||
const [windowDimensions, setWindowDimensions] = useState( | ||
getWindowDimensions() | ||
); | ||
|
||
useEffect(() => { | ||
function handleResize() { | ||
setWindowDimensions(getWindowDimensions()); | ||
} | ||
|
||
window.addEventListener("resize", handleResize); | ||
return () => window.removeEventListener("resize", handleResize); | ||
}, []); | ||
|
||
return windowDimensions; | ||
}; | ||
|
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,9 +1,10 @@ | ||
import * as React from "react" | ||
import { Link } from "react-router-dom"; | ||
const BackButton: React.FC<{ | ||
link: string; | ||
}> = (props) => { | ||
return ( | ||
<a href={props.link} className={"text-md md:text-lg font-medium text-gray-300 font-Poppins hover:cursor-pointer hover:text-white transition-colors"}>{"< Go Back"}</a> | ||
<Link to={props.link} className={"text-md md:text-lg font-medium text-gray-300 font-Poppins hover:cursor-pointer hover:text-white transition-colors"}>{"< Go Back"}</Link> | ||
); | ||
} | ||
export default BackButton |
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