Skip to content

Commit 301b37e

Browse files
author
rxyhn
committed
fix: boxes pattern and inconsistent colors
1 parent 38fa2a3 commit 301b37e

File tree

7 files changed

+107
-65
lines changed

7 files changed

+107
-65
lines changed

src/components/Boxes.astro

Lines changed: 0 additions & 45 deletions
This file was deleted.

src/components/Boxes.tsx

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import React, { useState, useEffect } from "react";
2+
3+
interface GridProps {
4+
className?: string;
5+
}
6+
7+
const Boxes: React.FC<GridProps> = ({ className = "" }) => {
8+
const [dimensions, setDimensions] = useState({ width: 0, height: 0 });
9+
10+
useEffect(() => {
11+
const updateDimensions = () => {
12+
setDimensions({
13+
width: window.innerWidth,
14+
height: window.innerHeight,
15+
});
16+
};
17+
18+
window.addEventListener("resize", updateDimensions);
19+
updateDimensions();
20+
21+
return () => window.removeEventListener("resize", updateDimensions);
22+
}, []);
23+
24+
const getCellSize = () => {
25+
if (dimensions.width < 640) return 20; // sm
26+
if (dimensions.width < 768) return 30; // md
27+
if (dimensions.width < 1024) return 45; // lg
28+
return 88; // xl
29+
};
30+
31+
const cellSize = getCellSize();
32+
const columns = Math.ceil(dimensions.width / cellSize);
33+
const rows = Math.ceil(dimensions.height / 2 / cellSize); // Only half the screen height
34+
35+
return (
36+
<div
37+
className={`absolute h-1/2 w-full overflow-hidden ${className}`}
38+
style={{ zIndex: -1 }}
39+
>
40+
{/* Left gradient overlay */}
41+
<div className="absolute left-0 top-0 h-full w-1/2">
42+
<div className="absolute inset-0 z-30 bg-gradient-to-tl from-black from-50% via-transparent via-90% to-transparent to-100%" />
43+
<div className="flex h-full w-full flex-col divide-y divide-dashed divide-neutral-700 border-l border-t border-black">
44+
{Array.from({ length: rows }).map((_, rowIndex) => (
45+
<div
46+
key={rowIndex}
47+
className="relative flex w-full divide-x divide-dashed divide-neutral-700"
48+
style={{ height: `${cellSize}px` }}
49+
>
50+
{Array.from({ length: columns / 2 }).map((_, colIndex) => (
51+
<div key={colIndex} className="relative w-full bg-black">
52+
<div className="absolute inset-0.5 bg-black" />
53+
</div>
54+
))}
55+
</div>
56+
))}
57+
</div>
58+
</div>
59+
60+
{/* Right gradient overlay */}
61+
<div className="absolute right-0 top-0 h-full w-1/2">
62+
<div className="absolute inset-0 z-30 bg-gradient-to-tr from-black from-50% via-transparent via-90% to-transparent to-100%" />
63+
<div className="flex h-full w-full flex-col divide-y divide-dashed divide-neutral-700 border-l border-t border-black">
64+
{Array.from({ length: rows }).map((_, rowIndex) => (
65+
<div
66+
key={rowIndex}
67+
className="relative flex w-full divide-x divide-dashed divide-neutral-700"
68+
style={{ height: `${cellSize}px` }}
69+
>
70+
{Array.from({ length: columns / 2 }).map((_, colIndex) => (
71+
<div key={colIndex} className="relative w-full bg-black">
72+
<div className="absolute inset-0.5 bg-black" />
73+
</div>
74+
))}
75+
</div>
76+
))}
77+
</div>
78+
</div>
79+
</div>
80+
);
81+
};
82+
83+
export default Boxes;

src/components/Button.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const { link, text } = Astro.props;
44

55
<a
66
href={link}
7-
class="inline-flex w-full items-center justify-center rounded-full border border-neutral-950 bg-neutral-200 px-4 py-2 text-sm font-semibold text-neutral-950 backdrop-blur-xl transition-all duration-300 ease-out hover:border-neutral-200 hover:bg-neutral-950 hover:text-neutral-200 md:w-auto md:justify-start"
7+
class="inline-flex w-full items-center justify-center rounded-full border border-black bg-neutral-200 px-4 py-2 text-sm font-semibold text-black backdrop-blur-xl transition-all duration-300 ease-out hover:border-neutral-200 hover:bg-black hover:text-neutral-200 md:w-auto md:justify-start"
88
>
99
{text}
1010
</a>

src/components/Card.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const { url, description, highlights, name } = Astro.props as CardProps;
1616
class="group relative flex h-full flex-col items-stretch rounded-2xl p-7 duration-300 ease-out sm:p-5"
1717
>
1818
<span
19-
class="absolute inset-0 z-20 block h-full w-full rounded-2xl border border-dashed border-transparent bg-transparent duration-300 ease-out group-hover:-translate-x-1 group-hover:-translate-y-1 group-hover:border group-hover:border-dashed group-hover:border-neutral-600 group-hover:bg-neutral-950"
19+
class="absolute inset-0 z-20 block h-full w-full rounded-2xl border border-dashed border-transparent bg-transparent duration-300 ease-out group-hover:-translate-x-1 group-hover:-translate-y-1 group-hover:border group-hover:border-dashed group-hover:border-neutral-600 group-hover:bg-black"
2020
aria-hidden="true"></span>
2121
<span
2222
class="absolute inset-0 z-10 block h-full w-full rounded-2xl border border-dashed border-neutral-600 duration-300 ease-out group-hover:translate-x-1 group-hover:translate-y-1"

src/components/CollapseText.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default function CollapseText({ children }: CollapseTextProps) {
1010
return (
1111
<div className="relative">
1212
<div
13-
className={`relative flex flex-col gap-4 max-sm:!h-auto md:after:absolute md:after:bottom-0 md:after:h-12 md:after:w-full md:after:bg-gradient-to-t md:after:from-neutral-950 md:after:content-[''] ${
13+
className={`relative flex flex-col gap-4 max-sm:!h-auto md:after:absolute md:after:bottom-0 md:after:h-12 md:after:w-full md:after:bg-gradient-to-t md:after:from-black md:after:content-[''] ${
1414
expanded ? "after:hidden" : ""
1515
}`}
1616
style={{ maxHeight: expanded ? "none" : "50px", overflow: "hidden" }}

src/components/Footer.astro

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
import { basics } from "@cv";
3+
const { name } = basics;
4+
---
5+
6+
<footer class="w-full print:hidden">
7+
<div
8+
class="mx-auto items-center border-t border-neutral-800 bg-black px-6 py-4 text-center text-xs text-neutral-200 sm:mt-20"
9+
>
10+
© {new Date().getFullYear()}
11+
{name}. All rights reserved.
12+
</div>
13+
</footer>

src/layouts/Layout.astro

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
---
22
import NavBar from "@/components/NavBar.astro";
3+
import Footer from "@/components/Footer.astro";
34
import Starry from "@/components/Starry";
4-
import Boxes from "@/components/Boxes.astro";
5-
import { basics } from "@cv";
6-
const { name } = basics;
5+
import Boxes from "@/components/Boxes";
76
const { title } = Astro.props;
87
---
98

@@ -22,9 +21,9 @@ const { title } = Astro.props;
2221
/>
2322
</head>
2423
<body
25-
class="relative z-10 bg-neutral-950 leading-relaxed tracking-wide text-neutral-200 antialiased selection:bg-neutral-300 selection:text-neutral-900"
24+
class="relative flex min-h-screen flex-col bg-black leading-relaxed tracking-wide text-neutral-200 antialiased selection:bg-neutral-300 selection:text-neutral-900"
2625
>
27-
<Boxes />
26+
<Boxes client:load />
2827
<NavBar />
2928
<Starry
3029
client:idle
@@ -34,22 +33,14 @@ const { title } = Astro.props;
3433
maxSize={1.4}
3534
opacity={0.2}
3635
particleDensity={100}
37-
className="fixed z-0 h-full w-full"
36+
className="fixed inset-0 z-0"
3837
particleColor="#FFFFFF"
3938
/>
40-
<main
41-
class="flex flex-grow flex-col items-center justify-center pb-20 pt-16"
42-
>
39+
<main class="relative z-10 flex-grow py-16">
4340
<slot />
4441
</main>
45-
<footer class="bottom-0 left-0 z-50 w-full print:hidden">
46-
<div
47-
class="mx-auto h-14 w-full items-center border-l-0 border-r-0 border-t border-neutral-600/40 bg-neutral-900/60 px-6 py-4 text-center text-xs backdrop-blur-2xl"
48-
>
49-
© {new Date().getFullYear()}
50-
{name}. All rights reserved.
51-
</div>
52-
</footer>
42+
<Footer />
43+
5344
<script src="../scripts/main.ts"></script>
5445
</body>
5546
</html>

0 commit comments

Comments
 (0)