-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
53b5e55
commit e5370a3
Showing
9 changed files
with
69 additions
and
23 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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"use client" | ||
|
||
import { Link } from "@/navigation"; | ||
import { useTranslations } from "next-intl"; | ||
import { ComponentProps, FormEvent, useEffect, useState } from "react" | ||
|
||
interface Props extends ComponentProps<"a"> { | ||
target: string | ||
active?: boolean | ||
} | ||
|
||
export function HeaderAnchor({ target }: Readonly<Props>) { | ||
const t = useTranslations("Header"); | ||
|
||
const [anchorTarget, setAnchorTarget] = useState<HTMLElement | null>(null); | ||
|
||
useEffect(() => { | ||
setAnchorTarget(document.getElementById(target)) | ||
}, [target]) | ||
|
||
function handleClick(event: FormEvent<HTMLAnchorElement>) { | ||
event.preventDefault(); | ||
anchorTarget?.scrollIntoView({ behavior: "smooth", block: "start" }) | ||
} | ||
|
||
return <Link onClick={handleClick} href={`#${target}`}>{t(target)}</Link> | ||
} |
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,24 @@ | ||
import { ChangeLanguage, HeaderAnchor, ToggleTheme } from "@/components"; | ||
|
||
export function Header() { | ||
return ( | ||
<section | ||
id="header" | ||
className="fixed w-screen h-[100px] space-x-4 flex bg-zinc-400 dark:bg-zinc-900 border-b-4 border-green-700" | ||
> | ||
<nav className="px-4 gap-2 flex items-center w-full"> | ||
<div className="gap-4 flex flex-auto justify-center items-center"> | ||
<HeaderAnchor target="start"/> | ||
<HeaderAnchor target="about"/> | ||
<HeaderAnchor target="competencies"/> | ||
<HeaderAnchor target="projects"/> | ||
<HeaderAnchor target="contact"/> | ||
</div> | ||
<div className="ml-auto flex gap-2 mr-8"> | ||
<ToggleTheme /> | ||
<ChangeLanguage /> | ||
</div> | ||
</nav> | ||
</section> | ||
); | ||
} |
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