Skip to content

Commit 4941c2c

Browse files
committed
update header
1 parent b340e22 commit 4941c2c

5 files changed

Lines changed: 95 additions & 8 deletions

File tree

astro.config.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { defineConfig } from 'astro/config';
22
import tailwind from "@astrojs/tailwind";
33
import svelte from "@astrojs/svelte";
4-
54
import mdx from "@astrojs/mdx";
65

6+
import alpinejs from "@astrojs/alpinejs";
7+
78
// https://astro.build/config
89
export default defineConfig({
9-
integrations: [tailwind(), svelte(), mdx()]
10+
integrations: [tailwind(), svelte(), mdx(), alpinejs()]
1011
});

package-lock.json

Lines changed: 70 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@
1010
"astro": "astro"
1111
},
1212
"dependencies": {
13+
"@astrojs/alpinejs": "^0.4.0",
1314
"@astrojs/check": "^0.9.2",
1415
"@astrojs/mdx": "^3.1.4",
1516
"@astrojs/svelte": "^5.7.0",
1617
"@astrojs/tailwind": "^5.1.0",
1718
"@lottiefiles/svelte-lottie-player": "^0.3.1",
19+
"@types/alpinejs": "^3.13.10",
20+
"alpinejs": "^3.14.1",
1821
"astro": "^4.14.2",
1922
"svelte": "^4.2.19",
2023
"tailwindcss": "^3.4.10",

src/components/header.astro

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,25 @@ interface Props {
66
77
const { href, title } = Astro.props;
88
---
9-
10-
<ul class=" sticky inset-x-0 top-4 z-50 global-color flex justify-around w-1/3 rounded-full mx-auto my-5 text-2xl drop-shadow-sm">
9+
<!-- sticky inset-x-0 top-4 z-50 global-color flex justify-around w-1/3 rounded-full mx-auto my-5 text-2xl drop-shadow-sm -->
10+
<ul
11+
id="main-header"
12+
class=" duration-500 sticky inset-x-0 top-4 z-50 flex justify-around w-1/3 rounded-full mx-auto my-5 text-2xl drop-shadow-sm"
13+
>
1114
{title.map((item, index) => (
1215
<a href={href[index]} class=" m-4 font-medium hover:text-hover">{item}</a>
1316
))}
1417
</ul>
1518

19+
<script>
20+
let header:any = document.getElementById('main-header');
21+
22+
window.addEventListener('scroll', () => {
23+
if (window.scrollY > 50) {
24+
header.classList.add("global-color");
25+
} else {
26+
header.classList.remove("global-color");
27+
}
28+
});
29+
</script>
30+

src/pages/index.astro

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,8 @@ const cards = [
5252
// { title: "2D Printer", body: "yey" ,href: "" },
5353
// { title: "1D Printer", body: "null" ,href: "" }
5454
]
55-
56-
let atTop = true
5755
---
58-
<LayoutPage title="Mathieu Chavanel - Portfolio" @scroll.window = "alert('tutu')">
56+
<LayoutPage title="Mathieu Chavanel - Portfolio" >
5957
<CursorFollower client:load></CursorFollower>
6058
<Header title={["Accueil", "Projets", "Contact"]} href={["/", "/#projectHighlight", "/#contact"]}></Header>
6159
<div id="home" class=" flex w-full h-screen ">
@@ -154,7 +152,7 @@ let atTop = true
154152
}
155153

156154
.text-hover{
157-
text-shadow: 0px 0px 1px black;
155+
text-shadow: 0px 0px 1px rgba(0, 0, 0, 0.677);
158156
}
159157

160158
}

0 commit comments

Comments
 (0)