-
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.
* Scroll to top component * Refactor navigation
- Loading branch information
Showing
6 changed files
with
83 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
import Navigation from '@comp/navigation'; | ||
import Email from '@comp/email'; | ||
import cx from 'classnames'; | ||
import useScrollPosition from '@react-hook/window-scroll'; | ||
|
||
export default function Header() { | ||
const scrollPosition = useScrollPosition(); | ||
|
||
return ( | ||
<header className="py-8 absolute w-full top-0 left-0 hidden lg:block"> | ||
<header | ||
className={cx( | ||
'bg-white dark:bg-black fixed w-full top-0 left-0 z-40 transition duration-300 hidden lg:block', | ||
scrollPosition > 100 ? 'py-4 shadow-sm' : 'py-8', | ||
)} | ||
> | ||
<div className="container-fluid"> | ||
<div className="flex flex-col justify-between items-center md:flex-row"> | ||
<Email href="/">[email protected]</Email> | ||
|
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,20 @@ | ||
import cx from 'classnames'; | ||
import useScrollPosition from '@react-hook/window-scroll'; | ||
import { FiArrowUp } from 'react-icons/fi'; | ||
|
||
export default function ScrollTop() { | ||
const scrollPosition = useScrollPosition(); | ||
|
||
return ( | ||
<button | ||
className={cx( | ||
'bg-white hover:bg-gray-100 active:bg-gray-50 text-zinc-800 shadow-md fixed bottom-8 right-8 text-xl p-4 rounded transition', | ||
scrollPosition < 200 && 'opacity-0 pointer-events-none', | ||
)} | ||
onClick={() => window.scrollTo({ top: 0, behavior: 'smooth' })} | ||
> | ||
<span className="sr-only">Scroll to top</span> | ||
<FiArrowUp /> | ||
</button> | ||
); | ||
} |
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
cc9b767
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
oktaycolakoglu-2022 – ./
www.oktaycolakoglu.com
oktaycolakoglu-2022-oktaycolakoglu.vercel.app
oktaycolakoglu-2022.vercel.app
oktaycolakoglu-2022-git-main-oktaycolakoglu.vercel.app
oktaycolakoglu.com