From 60f54181d6d5e21d3140953dece51fee7a0d40c5 Mon Sep 17 00:00:00 2001 From: LofiSu <163713803+LofiSu@users.noreply.github.com> Date: Sun, 26 Jan 2025 04:27:57 +0000 Subject: home components --- src/App.css | 42 ------------------ src/App.tsx | 42 +++++------------- src/HomePage.tsx | 91 ++++++++++++++++++++++++++++++++++++++ src/components/FutureCard.tsx | 28 ++++++++++++ src/components/StatsCard.tsx | 26 +++++++++++ src/components/ThreeBackground.tsx | 72 ++++++++++++++++++++++++++++++ src/index.css | 68 ---------------------------- src/main.tsx | 10 ----- 8 files changed, 227 insertions(+), 152 deletions(-) delete mode 100644 src/App.css create mode 100644 src/HomePage.tsx create mode 100644 src/components/FutureCard.tsx create mode 100644 src/components/StatsCard.tsx create mode 100644 src/components/ThreeBackground.tsx delete mode 100644 src/index.css delete mode 100644 src/main.tsx (limited to 'src') diff --git a/src/App.css b/src/App.css deleted file mode 100644 index b9d355d..0000000 --- a/src/App.css +++ /dev/null @@ -1,42 +0,0 @@ -#root { - max-width: 1280px; - margin: 0 auto; - padding: 2rem; - text-align: center; -} - -.logo { - height: 6em; - padding: 1.5em; - will-change: filter; - transition: filter 300ms; -} -.logo:hover { - filter: drop-shadow(0 0 2em #646cffaa); -} -.logo.react:hover { - filter: drop-shadow(0 0 2em #61dafbaa); -} - -@keyframes logo-spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -} - -@media (prefers-reduced-motion: no-preference) { - a:nth-of-type(2) .logo { - animation: logo-spin infinite 20s linear; - } -} - -.card { - padding: 2em; -} - -.read-the-docs { - color: #888; -} diff --git a/src/App.tsx b/src/App.tsx index 3d7ded3..b708bf5 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,35 +1,13 @@ -import { useState } from 'react' -import reactLogo from './assets/react.svg' -import viteLogo from '/vite.svg' -import './App.css' - -function App() { - const [count, setCount] = useState(0) +import React from 'react'; +import { NextUIProvider } from '@nextui-org/react'; +import HomePage from './HomePage'; +const App: React.FC = () => { return ( - <> -
- - Vite logo - - - React logo - -
-

Vite + React

-
- -

- Edit src/App.tsx and save to test HMR -

-
-

- Click on the Vite and React logos to learn more -

- - ) -} + + + + ); +}; -export default App +export default App; diff --git a/src/HomePage.tsx b/src/HomePage.tsx new file mode 100644 index 0000000..dcbb88c --- /dev/null +++ b/src/HomePage.tsx @@ -0,0 +1,91 @@ +import React from 'react'; +import { motion } from 'framer-motion'; +import { FaGithub, FaDiscord } from 'react-icons/fa'; +import { SiPython, SiTypescript, SiReact } from 'react-icons/si'; +import { Button, Card } from '@nextui-org/react'; +import { ThreeBackground } from './components/ThreeBackground'; +import { StatsCard } from './components/StatsCard'; +import { FeatureCard } from './components/FeatureCard'; + +const HomePage: React.FC = () => { + return ( +
+ + + {/* Hero Section */} +
+ +

+ HydroRoll +

+

+ 下一代开源 TRPG 骰子机器人框架,为你的游戏体验带来无限可能 +

+
+ + +
+
+
+ + {/* Features Section */} +
+
+

+ 核心特性 +

+
+ } + title="Python 驱动" + description="基于 Python 构建,提供灵活且强大的插件系统" + /> + } + title="TypeScript 支持" + description="完整的 TypeScript 类型支持,提供更好的开发体验" + /> + } + title="现代化框架" + description="采用现代化的框架设计,支持多平台部署" + /> +
+
+
+ + {/* Stats Section */} +
+
+
+ + + +
+
+
+
+ ); +}; + +export default HomePage; diff --git a/src/components/FutureCard.tsx b/src/components/FutureCard.tsx new file mode 100644 index 0000000..5f8a95d --- /dev/null +++ b/src/components/FutureCard.tsx @@ -0,0 +1,28 @@ +import React from 'react'; +import { motion } from 'framer-motion'; +import { Card } from '@nextui-org/react'; + +interface FeatureCardProps { + icon: React.ReactNode; + title: string; + description: string; +} + +export const FeatureCard: React.FC = ({ icon, title, description }) => { + return ( + + +
+
+ {icon} +
+

{title}

+

{description}

+
+
+
+ ); +}; diff --git a/src/components/StatsCard.tsx b/src/components/StatsCard.tsx new file mode 100644 index 0000000..237f5dc --- /dev/null +++ b/src/components/StatsCard.tsx @@ -0,0 +1,26 @@ +import React from 'react'; +import { motion } from 'framer-motion'; +import { Card } from '@nextui-org/react'; + +interface StatsCardProps { + title: string; + value: string; +} + +export const StatsCard: React.FC = ({ title, value }) => { + return ( + + +
+

{value}

+

{title}

+
+
+
+ ); +}; diff --git a/src/components/ThreeBackground.tsx b/src/components/ThreeBackground.tsx new file mode 100644 index 0000000..1a6337c --- /dev/null +++ b/src/components/ThreeBackground.tsx @@ -0,0 +1,72 @@ +import React, { useEffect, useRef } from 'react'; +import * as THREE from 'three'; + +export const ThreeBackground: React.FC = () => { + const containerRef = useRef(null); + + useEffect(() => { + if (!containerRef.current) return; + + const scene = new THREE.Scene(); + const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000); + const renderer = new THREE.WebGLRenderer({ alpha: true }); + + renderer.setSize(window.innerWidth, window.innerHeight); + containerRef.current.appendChild(renderer.domElement); + + // Create particles + const geometry = new THREE.BufferGeometry(); + const vertices = []; + + for (let i = 0; i < 5000; i++) { + vertices.push( + THREE.MathUtils.randFloatSpread(2000), // x + THREE.MathUtils.randFloatSpread(2000), // y + THREE.MathUtils.randFloatSpread(2000) // z + ); + } + + geometry.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); + + const material = new THREE.PointsMaterial({ + color: 0x88ccff, + size: 2, + transparent: true, + opacity: 0.5 + }); + + const particles = new THREE.Points(geometry, material); + scene.add(particles); + + camera.position.z = 1000; + + const animate = () => { + requestAnimationFrame(animate); + particles.rotation.x += 0.0001; + particles.rotation.y += 0.0001; + renderer.render(scene, camera); + }; + + animate(); + + const handleResize = () => { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + renderer.setSize(window.innerWidth, window.innerHeight); + }; + + window.addEventListener('resize', handleResize); + + return () => { + window.removeEventListener('resize', handleResize); + containerRef.current?.removeChild(renderer.domElement); + }; + }, []); + + return ( +
+ ); +}; diff --git a/src/index.css b/src/index.css deleted file mode 100644 index 6119ad9..0000000 --- a/src/index.css +++ /dev/null @@ -1,68 +0,0 @@ -:root { - font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; - line-height: 1.5; - font-weight: 400; - - color-scheme: light dark; - color: rgba(255, 255, 255, 0.87); - background-color: #242424; - - font-synthesis: none; - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -a { - font-weight: 500; - color: #646cff; - text-decoration: inherit; -} -a:hover { - color: #535bf2; -} - -body { - margin: 0; - display: flex; - place-items: center; - min-width: 320px; - min-height: 100vh; -} - -h1 { - font-size: 3.2em; - line-height: 1.1; -} - -button { - border-radius: 8px; - border: 1px solid transparent; - padding: 0.6em 1.2em; - font-size: 1em; - font-weight: 500; - font-family: inherit; - background-color: #1a1a1a; - cursor: pointer; - transition: border-color 0.25s; -} -button:hover { - border-color: #646cff; -} -button:focus, -button:focus-visible { - outline: 4px auto -webkit-focus-ring-color; -} - -@media (prefers-color-scheme: light) { - :root { - color: #213547; - background-color: #ffffff; - } - a:hover { - color: #747bff; - } - button { - background-color: #f9f9f9; - } -} diff --git a/src/main.tsx b/src/main.tsx deleted file mode 100644 index bef5202..0000000 --- a/src/main.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { StrictMode } from 'react' -import { createRoot } from 'react-dom/client' -import './index.css' -import App from './App.tsx' - -createRoot(document.getElementById('root')!).render( - - - , -) -- cgit v1.2.3-70-g09d2