File tree Expand file tree Collapse file tree 3 files changed +72
-9
lines changed
Expand file tree Collapse file tree 3 files changed +72
-9
lines changed Original file line number Diff line number Diff line change 2626 <form id =" contactForm" action =" " class =" contact-form mt-[20px]" >
2727 <input
2828 type =" text"
29- name =" "
29+ name =" name "
3030 placeholder =" First name"
31- class =" formInputBg mt-[5px] w-full rounded-[5px] p-[10px]"
31+ class =" light:border-2 mt-[5px] w-full rounded-[5px] p-[10px] dark:border-2 "
3232 />
3333 <input
3434 type =" email"
35- name =" "
35+ name =" email "
3636 placeholder =" Email"
37- class =" formInputBg mt-[5px] w-full rounded-[5px] p-[10px]"
37+ class =" light:border-2 mt-[5px] w-full rounded-[5px] p-[10px] md:mt-[10px] md:p-[15px] dark:border-2 "
3838 />
3939 <textarea
40- name =" "
40+ name =" message "
4141 cols =" 30"
4242 rows =" 10"
4343 placeholder =" Message"
44- class =" formInputBg mt-[5px] h-[100px] w-full rounded-[10px] p-[10px] md:h-[120px]" ></textarea >
44+ class =" light:border-2 mt-[5px] h-[100px] w-full rounded-[10px] p-[10px] md:h-[120px]" ></textarea >
4545 <button class =" mt-[5px] h-[40px] rounded-[5px] bg-[#ffcc00] px-[20px] text-[#111]" > Send </button >
4646 </form >
4747 </div >
Original file line number Diff line number Diff line change 11---
2- const { href, name } = Astro .props ;
2+ interface Props {
3+ href: string ;
4+ name: string ;
5+ class? : string ;
6+ }
7+
8+ const { href, name, class : className } = Astro .props ;
39---
410
5- <a class = " link" href ={ href } aria-label ={ name } >
11+ <a class:list = { [ " link" , className ] } href ={ href } aria-label ={ name } >
612 <span >{ name } </span >
713</a >
14+
15+ <style >
16+ .link {
17+ @apply relative inline-block px-2 py-1 text-current no-underline transition-colors duration-200;
18+ }
19+
20+ .link:hover {
21+ @apply text-current opacity-80;
22+ }
23+
24+ .link span {
25+ @apply relative z-10;
26+ }
27+ </style >
Original file line number Diff line number Diff line change @@ -7,6 +7,15 @@ interface Props {
77}
88
99const { pages } = Astro .props ;
10+ const currentPath = Astro .url .pathname ;
11+
12+ // Helper function to check if a path is active (exact match or active parent)
13+ const isActive = (path : string ) => {
14+ if (path === " /" ) {
15+ return currentPath === " /" ;
16+ }
17+ return currentPath === path || currentPath .startsWith (` ${path }/ ` );
18+ };
1019---
1120
1221<nav class =" nav" >
@@ -16,9 +25,43 @@ const { pages } = Astro.props;
1625 .filter ((p ) => p .isActive )
1726 .map ((p ) => (
1827 <li class = " nav__list__item" >
19- <Link href = { p .path } name = { p .name } />
28+ <Link href = { p .path } name = { p .name ! } class = { isActive ( p . path ) ? " active " : " " } />
2029 </li >
2130 ))
2231 }
2332 </ul >
2433</nav >
34+
35+ <style >
36+ .nav {
37+ @apply flex items-center;
38+ }
39+
40+ .nav__list {
41+ @apply m-0 flex list-none gap-4 p-0;
42+ }
43+
44+ .nav__list__item {
45+ @apply relative;
46+ }
47+
48+ /* Active link styles */
49+ .nav__list__item :global(a.active) {
50+ @apply relative;
51+ }
52+
53+ .nav__list__item :global(a.active)::after {
54+ content: "";
55+ @apply absolute bottom-0 left-0 h-0.5 w-full scale-x-100 transform bg-current;
56+ animation: borderSlide 0.3s ease-out;
57+ }
58+
59+ @keyframes borderSlide {
60+ from {
61+ transform: scaleX(0);
62+ }
63+ to {
64+ transform: scaleX(1);
65+ }
66+ }
67+ </style >
You can’t perform that action at this time.
0 commit comments