Skip to content

Commit 823c0cf

Browse files
committed
updated header and about me section
1 parent eb5bbc4 commit 823c0cf

File tree

6 files changed

+183
-216
lines changed

6 files changed

+183
-216
lines changed

src/components/header.tsx

Lines changed: 31 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,40 @@ import { motion, useScroll } from "framer-motion";
44
import { cn } from "@/lib/utils";
55
import { useEffect, useRef, useState } from "react";
66
import { useNavigate, useLocation } from "react-router";
7-
import {
8-
Sheet,
9-
SheetClose,
10-
SheetContent,
11-
SheetFooter,
12-
SheetHeader,
13-
SheetTitle,
14-
SheetTrigger,
15-
} from "./ui/sheet";
16-
import { X } from "lucide-react";
7+
import { FolderOpenDot, User } from "lucide-react";
178
import simonIcon from "@/assets/simon-icon.png";
189

1910
export function Header() {
2011
const [isScrolled, setIsScrolled] = useState(false);
2112
const [isVisible, setIsVisible] = useState(true);
2213
const { scrollY } = useScroll();
2314
const lastScrollY = useRef(0);
15+
const lastVisibilityChangeY = useRef(0);
2416
const navigate = useNavigate();
2517
const location = useLocation();
2618

2719
useEffect(() => {
2820
return scrollY.on("change", (latest) => {
2921
const isScrolledNow = latest > 50;
3022
const isScrollingDown = latest > lastScrollY.current;
23+
const scrollDelta = latest - lastVisibilityChangeY.current;
3124

3225
// Always show header when near top
3326
if (!isScrolledNow) {
3427
setIsVisible(true);
28+
lastVisibilityChangeY.current = latest;
3529
} else {
36-
// When scrolled, show on scroll up, hide on scroll down
37-
setIsVisible(!isScrollingDown);
30+
// When scrolling up, show immediately
31+
if (!isScrollingDown) {
32+
setIsVisible(true);
33+
lastVisibilityChangeY.current = latest;
34+
} else {
35+
// When scrolling down, only hide after 50px delay
36+
if (scrollDelta >= 50) {
37+
setIsVisible(false);
38+
lastVisibilityChangeY.current = latest;
39+
}
40+
}
3841
}
3942

4043
setIsScrolled(isScrolledNow);
@@ -72,7 +75,7 @@ export function Header() {
7275
className={cn(
7376
"mx-auto rounded-full transition-colors max-w-5xl flex justify-between items-center mx-auto",
7477
isScrolled
75-
? "bg-card shadow-lg backdrop-blur-lg supports-[backdrop-filter]:bg-card/50"
78+
? "bg-card shadow-lg backdrop-blur-lg supports-[backdrop-filter]:bg-input/50"
7679
: "bg-transparent"
7780
)}
7881
animate={{
@@ -89,100 +92,25 @@ export function Header() {
8992
</Button>
9093

9194
<nav className="flex items-center">
92-
<div className="hidden md:flex">
93-
<Button
94-
variant="ghost"
95-
onClick={(e) => handleClick("projects", e)}
96-
>
97-
Projects
98-
</Button>
99-
<Button variant="ghost" onClick={(e) => handleClick("about", e)}>
100-
About
101-
</Button>
102-
<Button
103-
variant="ghost"
104-
onClick={(e) => handleClick("contact", e)}
105-
>
106-
Contact
107-
</Button>
108-
</div>
95+
<Button
96+
variant="ghost"
97+
size="icon"
98+
onClick={(e) => handleClick("projects", e)}
99+
>
100+
<FolderOpenDot />
101+
</Button>
102+
<Button
103+
variant="ghost"
104+
size="icon"
105+
onClick={(e) => handleClick("about", e)}
106+
>
107+
<User />
108+
</Button>
109109

110-
<div className="flex items-center">
111-
<ModeToggle />
112-
<Sheet>
113-
<SheetTrigger asChild className="md:hidden">
114-
<Button variant="ghost" size="icon">
115-
<MenuIcon className="h-6 w-6" />
116-
</Button>
117-
</SheetTrigger>
118-
<SheetContent side="right">
119-
<SheetHeader>
120-
<SheetTitle>
121-
<img
122-
src={simonIcon}
123-
alt="Simon Manzler"
124-
className="h-6 w-6"
125-
/>
126-
</SheetTitle>
127-
</SheetHeader>
128-
<div className="flex flex-col">
129-
<Button
130-
variant="link"
131-
className="justify-start"
132-
onClick={(e) => handleClick("projects", e)}
133-
>
134-
Projects
135-
</Button>
136-
<Button
137-
variant="link"
138-
className="justify-start"
139-
onClick={(e) => handleClick("about", e)}
140-
>
141-
About
142-
</Button>
143-
<Button
144-
variant="link"
145-
className="justify-start"
146-
onClick={(e) => handleClick("contact", e)}
147-
>
148-
Contact
149-
</Button>
150-
</div>
151-
<SheetFooter>
152-
<SheetClose asChild>
153-
<Button variant="ghost">
154-
<X className="h-6 w-6" />
155-
Close
156-
</Button>
157-
</SheetClose>
158-
</SheetFooter>
159-
</SheetContent>
160-
</Sheet>
161-
</div>
110+
<ModeToggle />
162111
</nav>
163112
</motion.div>
164113
</div>
165114
</motion.header>
166115
);
167116
}
168-
169-
function MenuIcon(props: React.SVGProps<SVGSVGElement>) {
170-
return (
171-
<svg
172-
{...props}
173-
xmlns="http://www.w3.org/2000/svg"
174-
width="24"
175-
height="24"
176-
viewBox="0 0 24 24"
177-
fill="none"
178-
stroke="currentColor"
179-
strokeWidth="2"
180-
strokeLinecap="round"
181-
strokeLinejoin="round"
182-
>
183-
<line x1="4" x2="20" y1="12" y2="12" />
184-
<line x1="4" x2="20" y1="6" y2="6" />
185-
<line x1="4" x2="20" y1="18" y2="18" />
186-
</svg>
187-
);
188-
}

src/components/pages/apps.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const Apps = () => {
2121
const navigate = useNavigate();
2222

2323
return (
24-
<div className="min-h-screen py-20">
24+
<div className="py-20">
2525
<div className="flex flex-col px-6">
2626
<h1 className="text-4xl md:text-5xl font-bold mb-4 tracking-tight">
2727
Apps

src/components/pages/project-details.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,14 @@ const ProjectDetails = () => {
6262
}
6363

6464
return (
65-
<div className="min-h-screen py-20">
65+
<div className="min-h-screen py-20 px-6">
6666
{/* Back Button */}
67-
<Button onClick={() => navigate("/")} variant="ghost" className="mb-8">
68-
<ArrowLeft className="mr-2 h-4 w-4" />
67+
<Button
68+
onClick={() => navigate("/")}
69+
variant="link"
70+
className="mb-8 justify-start"
71+
>
72+
<ArrowLeft />
6973
Back to Projects
7074
</Button>
7175

0 commit comments

Comments
 (0)