Stellar.ai — AI 生产力着陆页英雄区域
英雄区域来自 MIT 许可的
pulkitxm/claude-directory图库。
一个单屏、居中的 AI 生产力 SaaS 着陆页英雄区域,包含导航栏、黑灰渐变标题、主要 CTA、自动循环标签栏(分析、训练、测试、部署)、循环背景视频及标签驱动覆盖卡片、公司 Logo 行,全部带有交错淡入上升动画。基于 React 18、Vite、Tailwind CSS 3 和 Lucide 图标构建,使用 Inter 字体。
工作流程
- 将
example.html克隆 到用户工作区作为工作文件。 - 替换占位内容 为用户的真实品牌名称、标题、正文、数字和图像。交换资源时保持与原图尺寸一致。
- 保留设计系统。 下方构建规范中的调色板、字体比例、间距节奏和动态效果是标识的一部分 — 不要替换字体、重新着色调色板或移除装饰元素。
- 通过复制章节来扩展,切勿从其他模板导入布局。如果缺少某个章节,请使用此模板自身的样式从头设计。
- 保持动画可访问。 每个动画都必须遵循
prefers-reduced-motion,如构建规范要求。
输出约定
在 <artifact> 标签之间输出:
<artifact identifier="stellar-ai-landing-hero" type="text/html" title="Stellar.ai — AI 生产力着陆页英雄区域">
<!doctype html>
<html>...</html>
</artifact>
构建规范
产生此设计的原始提示,逐字呈现。
Stellar.ai — 着陆页英雄区域
概述
为 "Stellar.ai" AI 生产力着陆页构建英雄区域。它是一个单屏、居中、白色背景布局,包含导航栏、渐变标题、CTA、自动循环标签栏、带有四个标签驱动覆盖卡片的循环背景视频以及一行公司 Logo。所有元素以交错淡入上升效果呈现动画。
技术栈
- 框架: React 18(
react^18.3.1,react-dom^18.3.1),使用React.StrictMode引导。 - 构建工具: Vite(
vite^5.4.11)与@vitejs/plugin-react(^4.3.4)。 - 样式: Tailwind CSS(
tailwindcss^3.4.17)与postcss(^8.4.49)和autoprefixer(^10.4.20)。默认配置,无主题扩展。 - 图标: Lucide React(
lucide-react^0.468.0)。 - 字体: Inter(字重 400、500、600、700),从 Google Fonts 导入。
- 测试工具: Playwright(
playwright^1.60.0)。 - 显著技术: 使用内联
animationDelay实现的自定义 CSS 关键帧动画,通过setInterval实现的自动循环标签状态,以及基于当前标签键值的条件覆盖组件。
全局设置
字体
在 index.html 中从 Google Fonts 导入 Inter(字重 400、500、600、700)(附带 preconnect 提示):
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
rel="stylesheet"
/>
在 src/index.css 中设置正文字体:
body {
font-family: 'Inter', sans-serif;
}
index.html
lang="en",charset="UTF-8",视口width=device-width, initial-scale=1.0。<title>:Stellar.ai — Work Smarter. Move Faster.<meta name="description">:Intelligent automation syncs with the tools you love to streamline tasks, boost output, and save time.- 根挂载点:
<div id="root"></div>与<script type="module" src="/src/main.jsx"></script>。
入口点 (src/main.jsx)
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App.jsx'
import './index.css'
ReactDOM.createRoot(document.getElementById('root')).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)
Tailwind 配置 (tailwind.config.js)
默认配置,无自定义主题扩展。内容路径如下:
/** @type {import('tailwindcss').Config} */
export default {
content: ['./index.html', './src/**/*.{js,jsx}'],
theme: {
extend: {},
},
plugins: [],
}
PostCSS 配置 (postcss.config.js)
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
Vite 配置 (vite.config.js)
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
})
动画
在 src/index.css 中定义,位于 Tailwind 层之上(@tailwind base; @tailwind components; @tailwind utilities;)。
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(30px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.animate-fade-in-up {
animation: fadeInUp 0.6s ease-out forwards;
}
@keyframes fadeInOverlay {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.animate-fade-in-overlay {
animation: fadeInOverlay 0.4s ease-out forwards;
}
@keyframes fadeInDialog {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.animate-slide-up-overlay {
animation: fadeInDialog 0.5s ease-out forwards;
transform: translate(-50%, -50%);
}
fadeInUp→from { opacity: 0; transform: translateY(30px) }到{ opacity: 1; transform: translateY(0) }。类.animate-fade-in-up以0.6s ease-out forwards运行。fadeInOverlay→from { opacity: 0 }到{ opacity: 1 }。类.animate-fade-in-overlay以0.4s ease-out forwards运行。fadeInDialog→from { opacity: 0 }到{ opacity: 1 }。类.animate-slide-up-overlay以0.5s ease-out forwards运行,并应用transform: translate(-50%, -50%)(用于居中对话框卡片)。- 每个主要部分均使用
.animate-fade-in-up,并带有交错的animationDelay(从0.1s开始,每次递增0.1s)。每个元素从内联opacity: 0开始,以便动画将其填充为可见。
布局
- 根包装器:
bg-white min-h-screen text-black。 - 页面由一个
<Navigation />头部和一个居中的<main>组成。 <main>类:px-6 pt-24 pb-32 max-w-7xl mx-auto text-center。
导航栏
包装在 <header> 中,带有 animate-fade-in-up 和内联 style={{ opacity: 0, animationDelay: '0.1s' }}。<nav> 使用 px-6 py-4 flex items-center justify-between max-w-7xl mx-auto。
- 左侧(Logo): 一个
<a href="#" className="flex items-center gap-2">,包含 Lucide 的Star图标(w-5 h-5 fill-black text-black)和品牌文字Stellar.ai,位于<span className="text-lg font-semibold">中。 - 中间(移动端隐藏):
hidden md:flex items-center gap-8。四个链接:Solutions带一个ChevronDown图标(w-4 h-4),链接类flex items-center gap-1 text-sm text-gray-700 hover:text-black transition-colors。For Teams带一个ChevronDown图标(w-4 h-4),相同链接类。About Us—text-sm text-gray-700 hover:text-black transition-colors。Learn Hub—text-sm text-gray-700 hover:text-black transition-colors。
- 右侧:
flex items-center gap-4。Login链接 —text-sm text-gray-700 hover:text-black transition-colors。Get started free按钮 —bg-black text-white px-5 py-2.5 rounded-full text-sm font-medium hover:bg-gray-800 transition-colors。
英雄区域
所有英雄元素都位于 <main> 内部,并使用 animate-fade-in-up 及交错的延迟。
评价徽章(延迟 0.2s)
- 包装器:
inline-flex items-center gap-2 mb-8。 - 一个带边框的正方形:
w-6 h-6 border border-gray-300 rounded flex items-center justify-center,包含一个填充的Star图标(w-3.5 h-3.5 fill-black text-black)。 - 文字:
4.9 rating from 18.3K+ users,使用text-sm font-medium text-black。
主标题(延迟 0.3s)
<h1>类:text-6xl md:text-7xl lg:text-[80px] font-normal leading-[1.1] tracking-tight mb-5。- 第一行:
Work Smarter. Move Faster. <br />- 第二行(渐变文字):
AI Powers You Up.包装在<span>中,带有bg-gradient-to-r from-black via-gray-500 to-gray-400 bg-clip-text text-transparent。
副标题(延迟 0.4s)
<p>类:text-lg md:text-xl text-gray-600 mb-8 max-w-2xl mx-auto。- 文字:
Intelligent automation syncs with the tools you love to streamline tasks, boost output, and save time.
CTA 按钮(延迟 0.5s)
- 包装在
div中,带有animate-fade-in-up和内联style={{ opacity: 0, animationDelay: '0.5s' }}。 - 按钮类:
bg-black text-white px-8 py-3 rounded-full text-base font-medium hover:bg-gray-800 transition-colors mb-12。 - 文字:
Begin Free Trial。
标签栏(延迟 0.6s)
包装器:animate-fade-in-up flex justify-center mb-8,内联 style={{ opacity: 0, animationDelay: '0.6s' }}。
四个标签,定义为 TABS 常量:
const TABS = [
{ id: 'analyse', label: 'Analyse', icon: BarChart3 },
{ id: 'train', label: 'Train', icon: BookOpen },
{ id: 'testing', label: 'Testing', icon: Users },
{ id: 'deploy', label: 'Deploy', icon: Rocket },
]
- 移动端(
md:hidden): 一个 2×2 网格 —md:hidden grid grid-cols-2 gap-1 bg-gray-100 rounded-lg p-1— 渲染所有四个按钮。 - 桌面端(
hidden md:flex): 一行 —hidden md:flex items-center bg-gray-100 rounded-lg p-1— 在除第一个按钮外的每个按钮前放置一个垂直分隔线:<div className="w-px h-5 bg-gray-300 mx-1" />。 - 每个标签按钮:
flex items-center justify-center gap-2 px-5 py-2 rounded-md text-sm font-medium transition-colors,带有一个 Lucide 图标(w-4 h-4)和标签文字。- 激活:
bg-white text-black shadow-sm。 - 未激活:
text-gray-600。
- 激活:
- 标签每
4000ms(4 秒)通过setInterval在useEffect内部自动循环,前进到下一个标签 id(循环)。状态:useState('analyse')。卸载时清除间隔。
useEffect(() => {
const interval = setInterval(() => {
setActiveTab((current) => {
const index = TABS.findIndex((tab) => tab.id === current)
return TABS[(index + 1) % TABS.length].id
})
}, 4000)
return () => clearInterval(interval)
}, [])
视频 + 覆盖区域(延迟 0.7s)
-
容器:
animate-fade-in-up relative rounded-3xl overflow-hidden h-[400px] md:h-[500px],内联style={{ opacity: 0, animationDelay: '0.7s' }}。 -
视频元素:
autoPlay,loop,muted,playsInline,类w-full h-full object-cover。来源来自VIDEO_SRC常量:const VIDEO_SRC = '/assets/hf_20260319_165750_358b1e72-c921-48b7-aaac-f200994f32fb.mp4'注意: 原始简报引用了一个远程 CloudFront URL(
https://d8j0ntlcm91z4.cloudfront.net/user_38xzzbokvigwjottwixh07lwa1p/hf_20260319_165750_358b1e72-c921-48b7-aaac-f200994f32fb.mp4)。该资源已本地化,现在源指向/assets/hf_20260319_165750_358b1e72-c921-48b7-aaac-f200994f32fb.mp4(从public/assets/提供)。本地路径是真实的。 -
激活覆盖:
<ActiveOverlay key={activeTab} />— 覆盖组件根据激活标签 id 从OVERLAYS映射中选择,并在每次标签更改时通过key重新挂载以触发其动画。
const OVERLAYS = {
analyse: AnalyseOverlay,
train: TrainOverlay,
testing: TestingOverlay,
deploy: DeployOverlay,
}
共享覆盖外壳(OverlayCard)
每个覆盖都包装在一个可重用的 OverlayCard 组件中,该组件渲染暗色背景和居中动画对话框卡片:
function OverlayCard({ children }) {
return (
<div className="absolute inset-0 animate-fade-in-overlay" style={{ opacity: 0 }}>
<div className="absolute inset-0 bg-black/30" />
<div
className="animate-slide-up-overlay absolute top-1/2 left-1/2 w-[calc(100%-3rem)] max-w-sm bg-white rounded-2xl shadow-2xl p-6 text-left"
style={{ opacity: 0 }}
>
{children}
</div>
</div>
)
}
- 外部包装器:
absolute inset-0 animate-fade-in-overlay,内联opacity: 0。 - 背景:
absolute inset-0 bg-black/30。 - 内部卡片:
animate-slide-up-overlay absolute top-1/2 left-1/2 w-[calc(100%-3rem)] max-w-sm bg-white rounded-2xl shadow-2xl p-6 text-left,内联opacity: 0。
覆盖 A — 分析:"Set Up Your AI Workspace"
一个 4 步设置向导,带有 25% 的紫色进度条。
- 标题行(
flex items-center justify-between mb-1):标题<h3 className="text-base font-semibold text-black">Set Up Your AI Workspace</h3>和步骤计数器<span className="text-xs font-medium text-gray-500">Step 1 of 4</span>。 - 副文本(
text-xs text-gray-500 mb-4):A few quick steps and Stellar.ai is ready to work. - 进度轨道:
h-1.5 w-full bg-gray-100 rounded-full mb-5 overflow-hidden,填充h-full w-1/4 bg-purple-600 rounded-full。 - 步骤列表(
<ul className="space-y-3">),四个项目:Connect your tools— 状态activeImport workspace data— 状态pendingConfigure AI assistant— 状态pendingInvite your team— 状态pending
- 每个步骤:一个编号徽章
w-6 h-6 rounded-full flex items-center justify-center text-xs font-semibold和一个标签。- 激活徽章:
bg-purple-600 text-white;激活标签:font-medium text-black。 - 待定徽章:
bg-gray-100 text-gray-400;待定标签:text-gray-500。
- 激活徽章:
覆盖 B — 训练:"AI Model Training"
一个训练面板,带有 67% 的橙色进度条和四个指标卡片。
- 标题行(
flex items-center justify-between mb-1):标题<h3 className="text-base font-semibold text-black">AI Model Training</h3>和一个状态药丸flex items-center gap-1.5 text-xs font-medium text-orange-600,包含一个脉冲点(w-1.5 h-1.5 rounded-full bg-orange-500 animate-pulse)和文字Running。 - 副文本(
text-xs text-gray-500 mb-4):Fine-tuning in progress. Metrics update in real time. - 指标卡片网格:
grid grid-cols-2 gap-3。- 精度(Accuracy):
bg-gray-50 rounded-xl p-3— 值<p className="text-lg font-bold text-black">94.2%</p>,标签<span className="text-xs text-gray-500">Accuracy</span>。 - 损失(Loss):
bg-gray-50 rounded-xl p-3— 值<p className="text-lg font-bold text-black">0.32</p>,标签<span className="text-xs text-gray-500">Loss</span>。 - 召回率(Recall):
bg-gray-50 rounded-xl p-3— 值<p className="text-lg font-bold text-black">91.8%</p>,标签<span className="text-xs text-gray-500">Recall</span>。 - F1 分数(F1 Score):
bg-gray-50 rounded-xl p-3— 值<p className="text-lg font-bold text-black">93.0%</p>,标签<span className="text-xs text-gray-500">F1 Score</span>。
- 精度(Accuracy):
覆盖 C — 测试:"User Acceptance Testing"
一个测试票务面板,带有状态指示和会话列表。
- 标题行(
flex items-center justify-between mb-1):标题<h3 className="text-base font-semibold text-black">User Acceptance Testing</h3>和一个状态药丸flex items-center gap-1.5 text-xs font-medium text-green-600,包含一个绿色点(w-1.5 h-1.5 rounded-full bg-green-500)和文字3 Active。 - 副文本(
text-xs text-gray-500 mb-4):Gather real-time feedback from testers. - 会话列表(
<ul className="space-y-3">),三个项目:- 每个会话都是一个
flex items-center gap-3 p-2 rounded-lg hover:bg-gray-50。 - 头像占位符:
w-8 h-8 rounded-full bg-gray-200 flex items-center justify-center text-xs text-gray-500包含姓名首字母。 - 名称:
<span className="text-sm font-medium text-black">John D.</span>。 - 状态:
<span className="text-xs text-gray-500">10 min ago</span>。
- 每个会话都是一个
覆盖 D — 部署:"Deployment Ready"
一个部署检查清单,带有进度和完成状态。
- 标题行(
flex items-center justify-between mb-1):标题<h3 className="text-base font-semibold text-black">Deployment Ready</h3>和一个绿色勾选图标<CheckCircle className="w-5 h-5 text-green-500" />。 - 副文本(
text-xs text-gray-500 mb-4):All checks passed. Ready to ship. - 检查清单(
<ul className="space-y-2">),四个项目(每个项目有完成或待定标签):Code merged— 完成:<Check className="w-4 h-4 text-green-500" />。Tests passed— 完成:<Check className="w-4 h-4 text-green-500" />。Approval received— 完成:<Check className="w-4 h-4 text-green-500" />。Deploy to production— 待定:<Loader className="w-4 h-4 text-gray-400 animate-spin" />。
公司 Logo 行
包装在 <div className="mt-10 animate-fade-in-up" style={{ opacity: 0, animationDelay: '0.8s' }}> 中。
- 内部包装器:
flex flex-wrap items-center justify-center gap-8 md:gap-12 opacity-50。 - 六个占位 Logo div:
h-8 w-24 bg-gray-200 rounded-md。
完整 App 组件 (src/App.jsx)
import React, { useState, useEffect } from 'react'
import { Star, ChevronDown, BarChart3, BookOpen, Users, Rocket, CheckCircle, Check, Loader } from 'lucide-react'
const TABS = [
{ id: 'analyse', label: 'Analyse', icon: BarChart3 },
{ id: 'train', label: 'Train', icon: BookOpen },
{ id: 'testing', label: 'Testing', icon: Users },
{ id: 'deploy', label: 'Deploy', icon: Rocket },
]
const VIDEO_SRC = '/assets/hf_20260319_165750_358b1e72-c921-48b7-aaac-f200994f32fb.mp4'
function OverlayCard({ children }) {
return (
<div className="absolute inset-0 animate-fade-in-overlay" style={{ opacity: 0 }}>
<div className="absolute inset-0 bg-black/30" />
<div
className="animate-slide-up-overlay absolute top-1/2 left-1/2 w-[calc(100%-3rem)] max-w-sm bg-white rounded-2xl shadow-2xl p-6 text-left"
style={{ opacity: 0 }}
>
{children}
</div>
</div>
)
}
function AnalyseOverlay() {
return (
<OverlayCard>
<div className="flex items-center justify-between mb-1">
<h3 className="text-base font-semibold text-black">Set Up Your AI Workspace</h3>
<span className="text-xs font-medium text-gray-500">Step 1 of 4</span>
</div>
<p className="text-xs text-gray-500 mb-4">A few quick steps and Stellar.ai is ready to work.</p>
<div className="h-1.5 w-full bg-gray-100 rounded-full mb-5 overflow-hidden">
<div className="h-full w-1/4 bg-purple-600 rounded-full" />
</div>
<ul className="space-y-3">
<li className="flex items-center gap-3">
<span className="w-6 h-6 rounded-full flex items-center justify-center text-xs font-semibold bg-purple-600 text-white">1</span>
<span className="text-sm font-medium text-black">Connect your tools</span>
</li>
<li className="flex items-center gap-3">
<span className="w-6 h-6 rounded-full flex items-center justify-center text-xs font-semibold bg-gray-100 text-gray-400">2</span>
<span className="text-sm text-gray-500">Import workspace data</span>
</li>
<li className="flex items-center gap-3">
<span className="w-6 h-6 rounded-full flex items-center justify-center text-xs font-semibold bg-gray-100 text-gray-400">3</span>
<span className="text-sm text-gray-500">Configure AI assistant</span>
</li>
<li className="flex items-center gap-3">
<span className="w-6 h-6 rounded-full flex items-center justify-center text-xs font-semibold bg-gray-100 text-gray-400">4</span>
<span className="text-sm text-gray-500">Invite your team</span>
</li>
</ul>
</OverlayCard>
)
}
function TrainOverlay() {
return (
<OverlayCard>
<div className="flex items-center justify-between mb-1">
<h3 className="text-base font-semibold text-black">AI Model Training</h3>
<span className="flex items-center gap-1.5 text-xs font-medium text-orange-600">
<span className="w-1.5 h-1.5 rounded-full bg-orange-500 animate-pulse" />
Running
</span>
</div>
<p className="text-xs text-gray-500 mb-4">Fine-tuning in progress. Metrics update in real time.</p>
<div className="grid grid-cols-2 gap-3">
<div className="bg-gray-50 rounded-xl p-3">
<p className="text-lg font-bold text-black">94.2%</p>
<span className="text-xs text-gray-500">Accuracy</span>
</div>
<div className="bg-gray-50 rounded-xl p-3">
<p className="text-lg font-bold text-black">0.32</p>
<span className="text-xs text-gray-500">Loss</span>
</div>
<div className="bg-gray-50 rounded-xl p-3">
<p className="text-lg font-bold text-black">91.8%</p>
<span className="text-xs text-gray-500">Recall</span>
</div>
<div className="bg-gray-50 rounded-xl p-3">
<p className="text-lg font-bold text-black">93.0%</p>
<span className="text-xs text-gray-500">F1 Score</span>
</div>
</div>
</OverlayCard>
)
}
function TestingOverlay() {
return (
<OverlayCard>
<div className="flex items-center justify-between mb-1">
<h3 className="text-base font-semibold text-black">User Acceptance Testing</h3>
<span className="flex items-center gap-1.5 text-xs font-medium text-green-600">
<span className="w-1.5 h-1.5 rounded-full bg-green-500" />
3 Active
</span>
</div>
<p className="text-xs text-gray-500 mb-4">Gather real-time feedback from testers.</p>
<ul className="space-y-3">
{['John D.', 'Sarah K.', 'Mike L.'].map((name, i) => (
<li key={i} className="flex items-center gap-3 p-2 rounded-lg hover:bg-gray-50">
<div className="w-8 h-8 rounded-full bg-gray-200 flex items-center justify-center text-xs text-gray-500">
{name.split(' ').map(n => n[0]).join('')}
</div>
<span className="text-sm font-medium text-black">{name}</span>
<span className="text-xs text-gray-500 ml-auto">{['10 min ago', '1 hour ago', '2 hours ago'][i]}</span>
</li>
))}
</ul>
</OverlayCard>
)
}
function DeployOverlay() {
return (
<OverlayCard>
<div className="flex items-center justify-between mb-1">
<h3 className="text-base font-semibold text-black">Deployment Ready</h3>
<CheckCircle className="w-5 h-5 text-green-500" />
</div>
<p className="text-xs text-gray-500 mb-4">All checks passed. Ready to ship.</p>
<ul className="space-y-2">
<li className="flex items-center gap-2">
<Check className="w-4 h-4 text-green-500" />
<span className="text-sm text-black">Code merged</span>
</li>
<li className="flex items-center gap-2">
<Check className="w-4 h-4 text-green-500" />
<span className="text-sm text-black">Tests passed</span>
</li>
<li className="flex items-center gap-2">
<Check className="w-4 h-4 text-green-500" />
<span className="text-sm text-black">Approval received</span>
</li>
<li className="flex items-center gap-2">
<Loader className="w-4 h-4 text-gray-400 animate-spin" />
<span className="text-sm text-gray-500">Deploy to production</span>
</li>
</ul>
</OverlayCard>
)
}
const OVERLAYS = {
analyse: AnalyseOverlay,
train: TrainOverlay,
testing: TestingOverlay,
deploy: DeployOverlay,
}
export default function App() {
const [activeTab, setActiveTab] = useState('analyse')
useEffect(() => {
const interval = setInterval(() => {
setActiveTab((current) => {
const index = TABS.findIndex((tab) => tab.id === current)
return TABS[(index + 1) % TABS.length].id
})
}, 4000)
return () => clearInterval(interval)
}, [])
const ActiveOverlay = OVERLAYS[activeTab]
return (
<div className="bg-white min-h-screen text-black">
<header className="animate-fade-in-up" style={{ opacity: 0, animationDelay: '0.1s' }}>
<nav className="px-6 py-4 flex items-center justify-between max-w-7xl mx-auto">
<a href="#" className="flex items-center gap-2">
<Star className="w-5 h-5 fill-black text-black" />
<span className="text-lg font-semibold">Stellar.ai</span>
</a>
<div className="hidden md:flex items-center gap-8">
<a href="#" className="flex items-center gap-1 text-sm text-gray-700 hover:text-black transition-colors">
Solutions
<ChevronDown className="w-4 h-4" />
</a>
<a href="#" className="flex items-center gap-1 text-sm text-gray-700 hover:text-black transition-colors">
For Teams
<ChevronDown className="w-4 h-4" />
</a>
<a href="#" className="text-sm text-gray-700 hover:text-black transition-colors">About Us</a>
<a href="#" className="text-sm text-gray-700 hover:text-black transition-colors">Learn Hub</a>
</div>
<div className="flex items-center gap-4">
<a href="#" className="text-sm text-gray-700 hover:text-black transition-colors">Login</a>
<button className="bg-black text-white px-5 py-2.5 rounded-full text-sm font-medium hover:bg-gray-800 transition-colors">
Get started free
</button>
</div>
</nav>
</header>
<main className="px-6 pt-24 pb-32 max-w-7xl mx-auto text-center">
<div className="inline-flex items-center gap-2 mb-8 animate-fade-in-up" style={{ opacity: 0, animationDelay: '0.2s' }}>
<div className="w-6 h-6 border border-gray-300 rounded flex items-center justify-center">
<Star className="w-3.5 h-3.5 fill-black text-black" />
</div>
<span className="text-sm font-medium text-black">4.9 rating from 18.3K+ users</span>
</div>
<h1 className="text-6xl md:text-7xl lg:text-[80px] font-normal leading-[1.1] tracking-tight mb-5 animate-fade-in-up" style={{ opacity: 0, animationDelay: '0.3s' }}>
Work Smarter. Move Faster.
<br />
<span className="bg-gradient-to-r from-black via-gray-500 to-gray-400 bg-clip-text text-transparent">AI Powers You Up.</span>
</h1>
<p className="text-lg md:text-xl text-gray-600 mb-8 max-w-2xl mx-auto animate-fade-in-up" style={{ opacity: 0, animationDelay: '0.4s' }}>
Intelligent automation syncs with the tools you love to streamline tasks, boost output, and save time.
</p>
<div className="animate-fade-in-up" style={{ opacity: 0, animationDelay: '0.5s' }}>
<button className="bg-black text-white px-8 py-3 rounded-full text-base font-medium hover:bg-gray-800 transition-colors mb-12">
Begin Free Trial
</button>
</div>
<div className="animate-fade-in-up flex justify-center mb-8" style={{ opacity: 0, animationDelay: '0.6s' }}>
<div className="md:hidden grid grid-cols-2 gap-1 bg-gray-100 rounded-lg p-1">
{TABS.map((tab) => {
const Icon = tab.icon
return (
<button
key={tab.id}
onClick={() => setActiveTab(tab.id)}
className={`flex items-center justify-center gap-2 px-5 py-2 rounded-md text-sm font-medium transition-colors ${activeTab === tab.id ? 'bg-white text-black shadow-sm' : 'text-gray-600'}`}
>
<Icon className="w-4 h-4" />
{tab.label}
</button>
)
})}
</div>
<div className="hidden md:flex items-center bg-gray-100 rounded-lg p-1">
{TABS.map((tab, index) => {
const Icon = tab.icon
return (
<React.Fragment key={tab.id}>
{index > 0 && <div className="w-px h-5 bg-gray-300 mx-1" />}
<button
onClick={() => setActiveTab(tab.id)}
className={`flex items-center justify-center gap-2 px-5 py-2 rounded-md text-sm font-medium transition-colors ${activeTab === tab.id ? 'bg-white text-black shadow-sm' : 'text-gray-600'}`}
>
<Icon className="w-4 h-4" />
{tab.label}
</button>
</React.Fragment>
)
})}
</div>
</div>
<div className="animate-fade-in-up relative rounded-3xl overflow-hidden h-[400px] md:h-[500px]" style={{ opacity: 0, animationDelay: '0.7s' }}>
<video autoPlay loop muted playsInline className="w-full h-full object-cover">
<source src={VIDEO_SRC} type="video/mp4" />
</video>
<ActiveOverlay />
</div>
<div className="mt-10 animate-fade-in-up" style={{ opacity: 0, animationDelay: '0.8s' }}>
<div className="flex flex-wrap items-center justify-center gap-8 md:gap-12 opacity-50">
{[...Array(6)].map((_, i) => (
<div key={i} className="h-8 w-24 bg-gray-200 rounded-md" />
))}
</div>
</div>
</main>
</div>
)
}
测试 Playwright
注意:以下内容已在
example.html中预配置,但可能需要进行调整。
创建一个文件 tests/hero.spec.ts(在项目根目录):
import { test, expect } from '@playwright/test'
test('should display hero section with all elements', async ({ page }) => {
await page.goto('http://localhost:5173')
// 检查标题
await expect(page.getByText('Work Smarter. Move Faster.')).toBeVisible()
// 检查 CTA 按钮
await expect(page.getByText('Begin Free Trial')).toBeVisible()
// 检查标签
await expect(page.getByText('Analyse').first()).toBeVisible()
await expect(page.getByText('Train').first()).toBeVisible()
await expect(page.getByText('Testing').first()).toBeVisible()
await expect(page.getByText('Deploy').first()).toBeVisible()
})
注意事项和最佳实践
- 所有复制到一个元素上的动画类(如
animate-fade-in-up)都必须搭配内联style={{ opacity: 0 }},因为动画不会在没有任何初始状态的情况下填充元素。 - 每个元素的
animationDelay必须从0.1s开始,每次递增0.1s。 - 在添加任何新动画之前,优先使用现有的动画类,以保持一致性。
- 视频源假定位于
public/assets/目录;调整路径以匹配用户的项目。 - 如果可用,请用真实 Logo 替换占位 Logo div。