BLOG-7 Home page about me #26

Merged
squid merged 2 commits from BLOG-7_home_page_about_me into main 2025-01-20 03:35:28 +08:00
5 changed files with 85 additions and 11 deletions
Showing only changes of commit 5517766f3f - Show all commits

View File

@ -1,17 +1,13 @@
import SelfTags from "@/lib/home/framework/ui/SelfTags";
import AboutMe from "@/lib/home/framework/ui/AboutMe";
import FirstView from "@/lib/home/framework/ui/FirstView";
import Motto from "@/lib/home/framework/ui/Motto";
export default function HomePage() {
return (
<div className="mx-auto flex min-h-[--content-height] max-w-screen-xl flex-col justify-center gap-y-2.5 px-4 md:gap-y-8 md:px-6">
<h2 className="text-3xl font-bold text-gray-800 md:text-6xl">Hello </h2>
<h1 className="flex flex-row items-center gap-x-2 text-4xl font-extrabold text-gray-800 md:text-7xl">
<span></span>
<div className="rounded-lg bg-blue-600 px-1.5 py-1">
<span className="text-white">Squid</span>
</div>
<span></span>
</h1>
<SelfTags />
<div>
<FirstView />
<AboutMe />
<Motto />
</div>
);
}

View File

@ -0,0 +1,3 @@
export default function AboutMe() {
return <></>;
}

View File

@ -0,0 +1,40 @@
"use client";
import { useEffect, useRef, useState } from "react";
export default function AnimatedMark(props: { text: string; direction: "left" | "right" }) {
const [isVisible, setIsVisible] = useState(false);
const element = useRef<HTMLSpanElement | null>(null);
const origin = props.direction === "left" ? "origin-left" : "origin-right";
useEffect(() => {
if (!element.current) {
return;
}
const observer = new IntersectionObserver(
(entries) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
setIsVisible(true);
console.log(element.current);
observer.disconnect();
}
});
},
{ threshold: 1 },
);
observer.observe(element.current);
}, []);
return (
<span
ref={element}
className={`rounded-md bg-blue-600 px-1 py-0.5 text-white transition-transform delay-500 duration-1000 md:rounded-lg md:px-2.5 md:py-2 ${origin} ${isVisible ? "scale-x-100" : "scale-x-0"} `}
>
<span className="scale-x-100">{props.text}</span>
</span>
);
}

View File

@ -0,0 +1,17 @@
import SelfTags from "@/lib/home/framework/ui/SelfTags";
export default function FirstView() {
return (
<div className="mx-auto flex min-h-[--content-height] max-w-screen-xl flex-col justify-center gap-y-2.5 px-4 md:gap-y-8 md:px-6">
<h2 className="text-3xl font-bold text-gray-800 md:text-6xl">Hello </h2>
<h1 className="flex flex-row items-center gap-x-2 text-4xl font-extrabold text-gray-800 md:text-7xl">
<span></span>
<div className="rounded-lg bg-blue-600 px-1.5 py-1">
<span className="text-white">Squid</span>
</div>
<span></span>
</h1>
<SelfTags />
</div>
);
}

View File

@ -0,0 +1,18 @@
import AnimatedMark from "./AnimatedMark";
export default function Motto() {
return (
<div className="mx-auto flex min-h-[--content-height] max-w-screen-xl flex-col items-center justify-center gap-y-2.5 px-4 md:gap-y-8 md:px-6">
<div className="flex w-[19rem] flex-col gap-y-3 text-3xl font-bold text-gray-800 md:w-[38rem] md:gap-y-4 md:text-6xl">
<div className="flex w-full flex-row items-center justify-start gap-x-2.5">
<span>Keep</span>
<AnimatedMark text="Learning" direction="left" />
</div>
<div className="flex w-full flex-row items-center justify-end gap-x-2.5 md:gap-x-4">
<AnimatedMark text="Keep" direction="right" />
<span>Progressing</span>
</div>
</div>
</div>
);
}