dot. — 每日平静落地页
源自 MIT 许可的
pulkitxm/claude-directory图库。
一个单屏营销落地页,用于展示“dot.” —— 一款安静消息产品,每天将你与一个匿名同伴连接,仅发送一条消息。主视觉是一个全屏循环播放的手机背景视频,前面是一个带有动画效果的 Instrument Serif 标题,以及一个打字机效果,它会打字和删除短消息(“你在吗?”,“是的,我在。”,“待会儿聊。”),这些消息被定位在手机屏幕上显示,营造出一种安静、模拟的节奏。一个浮动的药丸导航栏和一个闪闪发光的“连接”行动号召按钮,完成了单屏的布局。
工作流程
- 将
example.html克隆到用户的工作区作为工作文件。 - 用用户的真实品牌名称、标题、正文、数字和图像替换占位内容。 替换资源时,保持现有图像尺寸。
- 保留设计系统。 下方构建规范中的调色板、字体尺度、间距节奏和动效是品牌标识——不要替换字体、不要重新着色调色板,也不要移除装饰元素。
- 通过复制现有区块来扩展页面,永远不要从其他模板导入布局。如果缺少某个部分,请使用此模板自己的语言从头设计。
- 保持动效的可访问性。 根据构建规范的要求,每个动画都必须遵循
prefers-reduced-motion。
输出契约
在 <artifact> 标签内输出:
<artifact identifier="dot-daily-calm-landing" type="text/html" title="dot. — 每日平静落地页">
<!doctype html>
<html>...</html>
</artifact>
构建规范
以下为生成此设计的原始提示,逐字呈现。
dot. — 每日平静落地页
概述
构建一个单屏营销落地页,用于展示“dot.” —— 一款安静消息产品,每天将你与一个匿名同伴连接,仅发送一条消息。主视觉是一个全屏循环播放的手机背景视频,前面是一个带有动画效果的标题,以及一个打字机效果,它会打字和删除短消息,这些消息被定位在手机屏幕上显示。
技术栈
- 框架: React 19(
react^19.0.0,react-dom^19.0.0)搭配 TypeScript(typescript~5.8.0) - 构建工具: Vite(
vite^6.0.0)搭配@vitejs/plugin-react(^4.3.4) - 样式: Tailwind CSS v4(
tailwindcss^4.0.0)通过@tailwindcss/vite(^4.0.0) - 动画: Motion(
motion^12.0.0),导入为motion/react - 字体: Instrument Serif 和 Inter(Google Fonts);"Nokia Cellphone FC Small"(自托管自定义字体,用于屏幕上的打字效果)
- 值得注意的技术: HTML5
<video>背景,由useState+useEffect中的setTimeout驱动的打字机(打字/删除)效果,以及通过 Motion 实现的闪烁光标
全局设置
在 index.html 中的字体
在 index.html 中添加 Instrument Serif 和 Inter 的 Google Fonts,并附上预连接提示:
<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=Instrument+Serif:ital@0;1&family=Inter:[email protected]&display=swap"
rel="stylesheet"
/>
- Instrument Serif: 正体和斜体(
ital@0;1)。 - Inter: 完整字重范围(
[email protected])。
将文档 <title> 设置为 dot. — Short notes. Daily calm.,元描述设置为 Linked with a single anonymous peer. One message every day. A quiet rhythm in the digital noise.
自定义 Nokia 字体(自托管)
屏幕上的打字文本使用 "Nokia Cellphone FC Small" 字体。它位于 public/fonts/ 下,是自托管的。在 src/index.css 顶部导入字体样式表:
@import url('/fonts/nokia-cellphone-fc-small.css');
该样式表声明了 @font-face(来源于 public/fonts/ 中的 440b53b1a1c65037f944ff19259d8014 文件 —— .eot, .woff, .woff2, .ttf, .svg):
@font-face {
font-family: "Nokia Cellphone FC Small";
src: url("/fonts/440b53b1a1c65037f944ff19259d8014.eot");
src: url("/fonts/440b53b1a1c65037f944ff19259d8014.eot?#iefix") format("embedded-opentype"),
url("/fonts/440b53b1a1c65037f944ff19259d8014.woff") format("woff"),
url("/fonts/440b53b1a1c65037f944ff19259d8014.woff2") format("woff2"),
url("/fonts/440b53b1a1c65037f944ff19259d8014.ttf") format("truetype"),
url("/fonts/440b53b1a1c65037f944ff19259d8014.svg#Nokia Cellphone FC Small") format("svg");
font-weight: normal;
font-style: normal;
font-display: swap;
}
注意:此字体最初来源于
https://db.onlinewebfonts.com/c/440b53b1a1c65037f944ff19259d8014?family=Nokia+Cellphone+FC+Small(Web Fonts,许可为 CC BY 4.0),此后已本地化。
Tailwind 主题和根样式(src/index.css)
在导入 Nokia 字体 CSS 后,导入 Tailwind 并配置主题变量:
@import url('/fonts/nokia-cellphone-fc-small.css');
@import "tailwindcss";
@theme {
--font-instrument: "Instrument Serif", serif;
--font-serif: "Instrument Serif", serif;
--font-sans: "Inter", sans-serif;
--font-nokia: "Nokia Cellphone FC Small", monospace;
}
@utility font-instrument {
font-family: "Instrument Serif", serif;
}
:root {
font-family: var(--font-sans);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizeLegibility;
}
- 定义
font-instrument工具,以便font-instrument可作为类使用。 - 根字体系列为
var(--font-sans)(Inter),并应用了抗锯齿。
入口点(src/main.tsx)
标准 React 19 入口:导入 ./index.css,在 <StrictMode> 中使用 createRoot 将 App 挂载到 #root。
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import "./index.css";
import App from "./App.tsx";
createRoot(document.getElementById("root")!).render(
<StrictMode>
<App />
</StrictMode>,
);
组件结构
创建一个主文件 src/App.tsx,其中包含四个组件:TypingMessages,Navbar,Hero,以及默认导出的 App。App 渲染一个 <main>,其中包裹了 <Navbar /> 和 <Hero />。
共享常量(App.tsx 顶部)
import { useEffect, useState } from "react";
import { motion } from "motion/react";
const MESSAGES = ["Are you here?", "Yes, I am.", "Speak soon."];
const TYPING_SPEED = 100;
const DELETING_SPEED = 50;
const PAUSE_BEFORE_DELETE = 2000;
const EASE_OUT_EXPO = [0.16, 1, 0.3, 1] as const;
const VIDEO_SRC =
"/assets/hf_20260427_054418_a6d194f0-ac86-4df9-abe5-ded73e596d7c.mp4";
const NAV_LINKS = ["Philosophy", "Trust", "Access", "Tribe"];
注意:视频位于
public/assets/hf_20260427_054418_a6d194f0-ac86-4df9-abe5-ded73e596d7c.mp4。它最初来源于https://d8j0ntlcm91z4.cloudfront.net/user_38XZZBokVIGWJoTtWiXh07lWa1p/hf_20260427_054418_a6d194f0-ac86-4df9-abe5-ded73e596d7c.mp4,此后已本地化。
Navbar 组件
一个浮动药丸导航栏,固定在视口顶部附近。
- 容器(
<header>): 固定在顶部,使用fixed top-6 left-1/2 -translate-x-1/2 w-[95%] max-w-5xl z-50 pointer-events-none—— 水平居中,宽度 95%,上限为max-w-5xl,位于其他图层之上,包装器级别不可交互。 - 导航(
<nav>):pointer-events-auto flex items-center justify-between rounded-full border border-black/10 bg-transparent backdrop-blur-md px-5 py-2.5 md:px-7—— 可交互,一个圆角的透明药丸,带有border-black/10边框,背景模糊,flex space-between 布局。 - Logo: 一个
<a href="#">,文本为dot.,样式为font-instrument text-[28px] tracking-tight text-[#1a1a1a] leading-none。 - 链接: 遍历
NAV_LINKS(Philosophy,Trust,Access,Tribe)。容器为hidden md:flex items-center gap-10(在移动端隐藏,在桌面端显示为 flex,间距为gap-10)。每个链接都是一个<a>,带有href={#${link.toLowerCase()}},样式为font-sans text-[14px] text-[#1a1a1a] transition-opacity duration-200 hover:opacity-50。 - CTA 按钮("Link up"): 一个
<a href="#access">,样式为group relative overflow-hidden rounded-full bg-[#0871E7] px-5 py-2 font-sans text-[14px] text-white shadow-[inset_0_-4px_4px_rgba(255,255,255,0.39)] outline-1 outline-[#0871E7] -outline-offset-1。- 顶部闪光: 按钮内部一个绝对定位的
<span aria-hidden="true">:absolute w-[80%] h-4 left-[10%] top-[1px] bg-gradient-to-b from-[#DEF0FC] to-transparent rounded-[12px] transition-transform duration-300 group-hover:scale-x-105—— 顶部附近一个微妙的突出矩形,在组悬停时稍微变宽。 - 标签: 一个
<span className="relative">Link up</span>,使文本位于闪光之上。
- 顶部闪光: 按钮内部一个绝对定位的
Hero 组件
一个全屏英雄区域,包含循环播放的背景视频和居中文本。
- 容器(
<section>):relative min-h-screen bg-[#F3F4ED] pt-24 md:pt-32 flex flex-col items-center overflow-hidden。 - 视频背景: 一个绝对定位的包装器
absolute inset-0 z-0,包含一个 HTML5<video>,样式为h-full w-full object-cover,带有src={VIDEO_SRC}和属性autoPlay,loop,muted,playsInline。在视频上方,添加一个空的覆盖层<div className="absolute inset-0 bg-white/5" />,以呈现轻微的色调。 - 文本容器:
relative z-20 pointer-events-none flex flex-col items-center px-6 text-center。 - 主标题:
Short notes. <br /> Daily calm.包裹在一个motion.div中,该 div 从initial={{ opacity: 0, scale: 0.95 }}动画到animate={{ opacity: 1, scale: 1 }},过渡效果为transition={{ duration: 1.5, ease: EASE_OUT_EXPO }}。<h1>样式为font-instrument text-[38px] md:text-[56px] lg:text-[72px] leading-[0.85] tracking-tight text-[#1a1a1a] mb-6。 - 副标题:
Linked with a single anonymous peer. One message every day. A quiet rhythm in the digital noise.包裹在一个motion.div中,该 div 从initial={{ opacity: 0, y: 20 }}动画到animate={{ opacity: 1, y: 0 }},过渡效果为transition={{ duration: 1.2, delay: 0.3, ease: EASE_OUT_EXPO }}。<p>样式为font-sans text-[16px] md:text-[18px] text-[#1a1a1a]/70 leading-relaxed font-normal max-w-xl mx-auto。 - 屏幕上的消息: 渲染
<TypingMessages />作为该部分的最后一个子元素,使其与视频中显示的手机屏幕重叠。
TypingMessages 组件
一个打字机效果,用于打字和删除短消息,定位在视频中的手机屏幕上。
逻辑
- 状态:
messageIndex(当前消息),text(当前可见字符串),以及isDeleting(打字 vs 删除)。 - 循环遍历
MESSAGES(["Are you here?", "Yes, I am.", "Speak soon."])。 - 时机:打字速度为
TYPING_SPEED(每字符100ms),删除速度为DELETING_SPEED(每字符50ms),并在消息完全打完后暂停PAUSE_BEFORE_DELETE(2000ms),然后开始删除。 - 当一条消息完全打完后(
!isDeleting && text === message),设置一个2000ms 的超时,开始删除。 - 当删除过程中完全删除后(
isDeleting && text === ""),停止删除,并通过(index + 1) % MESSAGES.length前进到下一条消息。 - 否则,每次 tick 添加或删除一个字符,使用
message.slice(0, text.length + 1)(打字)或message.slice(0, text.length - 1)(删除)。 - 使用一个以
[text, isDeleting, messageIndex]为键的单个useEffect驱动所有操作,并在清理函数中清除超时。
function TypingMessages() {
const [messageIndex, setMessageIndex] = useState(0);
const [text, setText] = useState("");
const [isDeleting, setIsDeleting] = useState(false);
useEffect(() => {
const message = MESSAGES[messageIndex];
if (!isDeleting && text === message) {
const pause = setTimeout(() => setIsDeleting(true), PAUSE_BEFORE_DELETE);
return () => clearTimeout(pause);
}
if (isDeleting && text === "") {
setIsDeleting(false);
setMessageIndex((index) => (index + 1) % MESSAGES.length);
return;
}
const tick = setTimeout(
() => {
setText(
isDeleting
? message.slice(0, text.length - 1)
: message.slice(0, text.length + 1),
);
},
isDeleting ? DELETING_SPEED : TYPING_SPEED,
);
return () => clearTimeout(tick);
}, [text, isDeleting, messageIndex]);
// ...渲染
}
定位和样式
- 包装器:
absolute left-[48.5%] md:left-[47.5%] lg:left-[48.5%] -translate-x-1/2 bottom-[32%] z-30 w-[110px] sm:w-[130px] flex justify-start text-left—— 绝对定位,使其跨断点落在手机屏幕上。 - 文本(
<p>):font-nokia text-[#2A3616] text-[10px] sm:text-[14px] leading-tight break-words min-h-[1.5em],渲染当前的{text}。 - 光标: 一个闪烁的
motion.span,样式为inline-block w-1.5 h-3 bg-[#2A3616] ml-1 align-middle,带有animate={{ opacity: [0, 1, 0] }}和transition={{ duration: 0.8, repeat: Infinity, ease: "linear" }}。
调色板
- Hero 背景:
#F3F4ED - 主要文本 / Logo:
#1a1a1a(也用于副标题的/70不透明度) - CTA 蓝色:
#0871E7(背景和轮廓) - CTA 闪光渐变: 从
#DEF0FC到透明 - CTA 内部阴影高亮:
rgba(255,255,255,0.39) - 导航栏边框:
black/10 - 视频色调覆盖层:
white/5 - Nokia 打字文本和光标:
#2A3616
动画摘要
- 标题: 不透明度
0 → 1,缩放0.95 → 1,持续时间1.5s,缓动[0.16, 1, 0.3, 1](EASE_OUT_EXPO)。 - 副标题: 不透明度
0 → 1,y20 → 0,持续时间1.2s,延迟0.3s,缓动[0.16, 1, 0.3, 1]。 - CTA 闪光: 组悬停时
scale-x-105,过渡效果为transition-transform duration-300。 - 导航链接:
hover:opacity-50,过渡效果为transition-opacity duration-200。 - 打字光标: 不透明度
[0, 1, 0],持续时间0.8s,repeat: Infinity,缓动为"linear"。 - 打字机: 打字速度
100ms/字符,