Skip to content

Commit 2f9bac8

Browse files
committed
x
1 parent d7a88a4 commit 2f9bac8

File tree

2 files changed

+88
-27
lines changed

2 files changed

+88
-27
lines changed

src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function App() {
88
return (
99
<div>
1010
<Header />
11-
<main className="container mx-auto p-4 md:p-8">
11+
<main className="container mx-auto mt-20">
1212
<About />
1313
<Projects />
1414
<Certifications />

src/components/Header.tsx

Lines changed: 87 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const Header: React.FC = () => {
1212
const [typingIndex, setTypingIndex] = useState("Software Engineer".length);
1313
const [isDeleting, setIsDeleting] = useState(false);
1414
const [isWaiting, setIsWaiting] = useState(true);
15+
const [isSidebarOpen, setIsSidebarOpen] = useState(false);
1516

1617
useEffect(() => {
1718
if (isWaiting) {
@@ -46,56 +47,116 @@ const Header: React.FC = () => {
4647
return () => clearTimeout(timeout);
4748
}, [roles, roleIndex, typingIndex, isDeleting, currentRole, isWaiting]);
4849

50+
const toggleSidebar = () => {
51+
setIsSidebarOpen((prev) => !prev);
52+
};
53+
4954
return (
50-
<header className="bg-gradient-to-r from-blue-500 via-purple-500 to-pink-500 py-4 shadow-sm">
55+
<header className="fixed top-0 left-0 w-full bg-gradient-to-r from-blue-500 via-purple-500 to-pink-500 py-4 shadow-sm z-50">
5156
<div className="container mx-auto flex items-center justify-between px-4">
52-
<div className="flex flex-col">
53-
<span className="text-2xl font-bold text-white leading-none">
54-
Sam Hillier
55-
</span>
56-
<span className="text-sm font-light text-gray-200 leading-none">
57-
{currentRole}
58-
<span className="animate-blink">|</span>
59-
</span>
57+
<div className="flex items-center space-x-4">
58+
<button
59+
className="md:hidden text-white focus:outline-none"
60+
onClick={toggleSidebar}
61+
>
62+
<svg
63+
className="w-6 h-6"
64+
xmlns="http://www.w3.org/2000/svg"
65+
fill="none"
66+
viewBox="0 0 24 24"
67+
stroke="currentColor"
68+
>
69+
<path
70+
strokeLinecap="round"
71+
strokeLinejoin="round"
72+
strokeWidth="2"
73+
d="M4 6h16M4 12h16M4 18h16"
74+
/>
75+
</svg>
76+
</button>
77+
<div className="flex flex-col cursor-pointer">
78+
<span className="text-2xl font-bold text-white leading-none text-nowrap">
79+
Sam Hillier
80+
</span>
81+
<span className="text-sm font-light text-gray-200 leading-none text-nowrap">
82+
{currentRole}
83+
<span className="animate-blink">|</span>
84+
</span>
85+
</div>
6086
</div>
6187

62-
<nav>
88+
<nav className="hidden md:block">
6389
<ul className="flex space-x-6 text-lg font-medium text-gray-100">
6490
<li>
65-
<a
66-
href="#about"
67-
className="relative block px-4 py-3 after:absolute after:bottom-0 after:left-0 after:w-0 after:h-[2px] after:bg-white after:transition-all after:duration-300 hover:after:w-full"
68-
>
91+
<a href="#about" className="hover:text-white">
6992
About
7093
</a>
7194
</li>
7295
<li>
73-
<a
74-
href="#projects"
75-
className="relative block px-4 py-3 after:absolute after:bottom-0 after:left-0 after:w-0 after:h-[2px] after:bg-white after:transition-all after:duration-300 hover:after:w-full"
76-
>
96+
<a href="#projects" className="hover:text-white">
7797
Projects
7898
</a>
7999
</li>
80100
<li>
81-
<a
82-
href="#skills"
83-
className="relative block px-4 py-3 after:absolute after:bottom-0 after:left-0 after:w-0 after:h-[2px] after:bg-white after:transition-all after:duration-300 hover:after:w-full"
84-
>
101+
<a href="#skills" className="hover:text-white">
85102
Skills
86103
</a>
87104
</li>
88105
<li>
89-
<a
90-
href="#contact"
91-
className="relative block px-4 py-3 after:absolute after:bottom-0 after:left-0 after:w-0 after:h-[2px] after:bg-white after:transition-all after:duration-300 hover:after:w-full"
92-
>
106+
<a href="#contact" className="hover:text-white">
93107
Contact
94108
</a>
95109
</li>
96110
</ul>
97111
</nav>
98112
</div>
113+
114+
<div
115+
className={`fixed inset-y-0 left-0 bg-gradient-to-r from-blue-600 via-purple-600 to-pink-600 shadow-lg transform ${
116+
isSidebarOpen ? "translate-x-0" : "-translate-x-full"
117+
} transition-transform duration-300 ease-in-out z-30`}
118+
>
119+
<button
120+
className="absolute top-4 right-4 text-white focus:outline-none"
121+
onClick={toggleSidebar}
122+
>
123+
<svg
124+
className="w-6 h-6"
125+
xmlns="http://www.w3.org/2000/svg"
126+
fill="none"
127+
viewBox="0 0 24 24"
128+
stroke="currentColor"
129+
>
130+
<path
131+
strokeLinecap="round"
132+
strokeLinejoin="round"
133+
strokeWidth="2"
134+
d="M6 18L18 6M6 6l12 12"
135+
/>
136+
</svg>
137+
</button>
138+
<nav className="mt-16 space-y-6 px-8 text-lg font-medium text-gray-100">
139+
<a href="#about" className="block hover:text-white">
140+
About
141+
</a>
142+
<a href="#projects" className="block hover:text-white">
143+
Projects
144+
</a>
145+
<a href="#skills" className="block hover:text-white">
146+
Skills
147+
</a>
148+
<a href="#contact" className="block hover:text-white">
149+
Contact
150+
</a>
151+
</nav>
152+
</div>
153+
154+
{isSidebarOpen && (
155+
<div
156+
className="fixed inset-0 bg-black bg-opacity-50 z-20"
157+
onClick={toggleSidebar}
158+
></div>
159+
)}
99160
</header>
100161
);
101162
};

0 commit comments

Comments
 (0)