diff --git a/frontend/src/app/page.tsx b/frontend/src/app/page.tsx index 8c21ab0..91218ef 100644 --- a/frontend/src/app/page.tsx +++ b/frontend/src/app/page.tsx @@ -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 ( -
-

Hello 大家好!

-

- 我是 -
- Squid -
- 魷魚 -

- +
+ + +
); } diff --git a/frontend/src/lib/home/framework/ui/AboutMe.tsx b/frontend/src/lib/home/framework/ui/AboutMe.tsx new file mode 100644 index 0000000..e3e1dbe --- /dev/null +++ b/frontend/src/lib/home/framework/ui/AboutMe.tsx @@ -0,0 +1,3 @@ +export default function AboutMe() { + return <>; +} diff --git a/frontend/src/lib/home/framework/ui/AnimatedMark.tsx b/frontend/src/lib/home/framework/ui/AnimatedMark.tsx new file mode 100644 index 0000000..513c8b7 --- /dev/null +++ b/frontend/src/lib/home/framework/ui/AnimatedMark.tsx @@ -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(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 ( + + {props.text} + + ); +} diff --git a/frontend/src/lib/home/framework/ui/FirstView.tsx b/frontend/src/lib/home/framework/ui/FirstView.tsx new file mode 100644 index 0000000..2dcb929 --- /dev/null +++ b/frontend/src/lib/home/framework/ui/FirstView.tsx @@ -0,0 +1,17 @@ +import SelfTags from "@/lib/home/framework/ui/SelfTags"; + +export default function FirstView() { + return ( +
+

Hello 大家好!

+

+ 我是 +
+ Squid +
+ 魷魚 +

+ +
+ ); +} diff --git a/frontend/src/lib/home/framework/ui/Motto.tsx b/frontend/src/lib/home/framework/ui/Motto.tsx new file mode 100644 index 0000000..3e3032e --- /dev/null +++ b/frontend/src/lib/home/framework/ui/Motto.tsx @@ -0,0 +1,18 @@ +import AnimatedMark from "./AnimatedMark"; + +export default function Motto() { + return ( +
+
+
+ Keep + +
+
+ + Progressing +
+
+
+ ); +}