feat: learn 页五问拼贴改版为课程概览——hero 成品换可操作演示(TodoPreview 可增删勾选,替代静态 TodoMock;ExperimentFrame 增 demo 态、address 可空)+数据控制四步流(learn-data-flow)+时间便签 compact+积木清单 overview 变体(stage/summary 直读、2/3 列网格;积木口径改平实说明,dom/props 换 api/database)+环境对照 connector=或;design-system 组件扩参默认值兼容旧用法(BrickToolbox variant/ComparisonBoard connector·title 可选/StickyNote size);Page 增 navigation=section(概览页只展开当前分块)、Section 支持 id/className;首页 CTA 从占位改为练习场实链、meta 文案同步;e2e learn.spec 6 测(交互/键盘可达/320–1280px 无横向溢出),全量 46 绿
Build Tutorial / Build @stack/tutorial (kaniko) (push) Failing after 43s
Build Tutorial / Build @stack/tutorial (kaniko) (push) Failing after 43s
This commit is contained in:
1 parent
e61b3a8f27
commit
a1110361a0
14 files changed
+339
-229
No files matched your search
@@ -0,0 +1,69 @@
|
||||
import { expect, test } from '@playwright/test'
|
||||
|
||||
test.describe('教程首页', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('/learn.html')
|
||||
})
|
||||
|
||||
test('成品演示可增删、勾选;空白输入不产生任务,刷新回到示例', async ({ page }) => {
|
||||
const demo = page.getByRole('group', { name: '待办应用演示' })
|
||||
const input = demo.getByRole('textbox', { name: '新的待办' })
|
||||
await expect(demo.getByRole('status')).toHaveText('2 件 · 完成 1')
|
||||
await input.fill(' ')
|
||||
await input.press('Enter')
|
||||
await expect(demo.getByRole('listitem')).toHaveCount(2)
|
||||
await input.fill(' 散步十分钟 ')
|
||||
await input.press('Enter')
|
||||
await expect(input).toHaveValue('')
|
||||
await expect(input).toBeFocused()
|
||||
const task = demo.getByRole('checkbox', { name: '散步十分钟', exact: true })
|
||||
await task.check()
|
||||
await expect(demo.getByRole('status')).toHaveText('3 件 · 完成 2')
|
||||
await expect(task.locator('+ span')).toHaveCSS('text-decoration-line', 'line-through')
|
||||
await task.uncheck()
|
||||
await expect(demo.getByRole('status')).toHaveText('3 件 · 完成 1')
|
||||
await demo.getByRole('button', { name: '删除散步十分钟', exact: true }).click()
|
||||
await expect(task).toHaveCount(0)
|
||||
await demo.getByRole('button', { name: '删除读十页书', exact: true }).click()
|
||||
await demo.getByRole('button', { name: '删除买牛奶', exact: true }).click()
|
||||
await expect(demo.getByRole('status')).toHaveText('0 件 · 完成 0')
|
||||
await expect(demo).toContainText('清单空了')
|
||||
await page.reload()
|
||||
await expect(demo.getByRole('status')).toHaveText('2 件 · 完成 1')
|
||||
})
|
||||
|
||||
test('技术用途直接可读,键盘能展开详情并使用实际学习入口', async ({ page }) => {
|
||||
const toolbox = page.locator('[data-comp="brick-toolbox"]')
|
||||
await expect(toolbox).toContainText('搭出输入框、列表和按钮。')
|
||||
const html = toolbox.locator('details').first()
|
||||
await expect(html.getByText('描述网页结构的标记语言。', { exact: false })).toBeHidden()
|
||||
await html.locator('summary').focus()
|
||||
await html.locator('summary').press('Enter')
|
||||
await expect(html.getByText('描述网页结构的标记语言。', { exact: false })).toBeVisible()
|
||||
await html.locator('summary').press('Enter')
|
||||
await expect(html.locator('dl')).toBeHidden()
|
||||
await page.getByRole('link', { name: '从第一个网页开始' }).click()
|
||||
await expect(page).toHaveURL(/\/ch1\.html$/)
|
||||
await expect(page.getByRole('heading', { name: /快速开始/ }).first()).toBeVisible()
|
||||
})
|
||||
|
||||
for (const width of [320, 390, 768, 1280]) {
|
||||
test(`概览及展开内容在 ${width}px 下可完整阅读`, async ({ page }) => {
|
||||
await page.setViewportSize({ width, height: 900 })
|
||||
await page.locator('[data-comp="brick-toolbox"] summary').first().click()
|
||||
const input = page.getByRole('textbox', { name: '新的待办' })
|
||||
await input.fill('LongUnbrokenTodo'.repeat(5))
|
||||
await input.press('Enter')
|
||||
const dimensions = await page.evaluate(() => ({
|
||||
viewport: innerWidth,
|
||||
document: document.documentElement.scrollWidth,
|
||||
content: [...document.querySelectorAll('.learn-hero, .learn-core, .learning-brick, .learning-comparison-page')].map((element) => {
|
||||
const rect = element.getBoundingClientRect()
|
||||
return { left: rect.left, right: rect.right }
|
||||
}),
|
||||
}))
|
||||
expect(dimensions.document).toBe(dimensions.viewport)
|
||||
expect(dimensions.content.filter((rect) => rect.left < 0 || rect.right > width)).toEqual([])
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -6,7 +6,7 @@
|
||||
<title>idealjs stack · 全栈教程与开发实践</title>
|
||||
<meta
|
||||
name="description"
|
||||
content="从第一个网页,到完整的应用。idealjs stack 提供全栈工程师教程,分享开发经验与工程实践,并计划推出基于 WebContainer 的在线 Agent 编辑器。"
|
||||
content="从第一个网页,到完整的应用。idealjs stack 提供全栈工程师教程,分享开发经验与工程实践,并提供基于 WebContainer 的在线 Agent 练习场。"
|
||||
/>
|
||||
</head>
|
||||
<body class="bg-paper text-ink">
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>开始学习 · idealjs stack 教程</title>
|
||||
<title>全栈教程 · 做一个自己的待办清单 · idealjs stack</title>
|
||||
<meta name="description" content="从页面、交互到 API 和数据库,逐步完成一个单人版 TodoList。了解技术积木、WebContainer 与 Agent 练习环境、预计学习时间,以及贯穿全栈的数据控制。" />
|
||||
</head>
|
||||
<body class="bg-paper text-ink">
|
||||
<div id="root"></div>
|
||||
|
||||
@@ -77,6 +77,7 @@ export function Page({
|
||||
subtitle,
|
||||
desc,
|
||||
active,
|
||||
navigation = 'all',
|
||||
children,
|
||||
}: {
|
||||
/** 章节页标题在章头横幅里,可省 */
|
||||
@@ -86,6 +87,8 @@ export function Page({
|
||||
desc?: string
|
||||
/** 站头高亮:章节 id / 首页 / 开始学习(learn)/ 分块着陆页(blog、design、practice)/ 设计系统册 / 博客月(blog-YYYY-MM) */
|
||||
active?: ChapterId | 'index' | 'learn' | 'blog' | 'design' | 'practice' | DesignKey | `blog-${string}`
|
||||
/** 概览页只展开当前分块;顶层入口始终可见。 */
|
||||
navigation?: 'all' | 'section'
|
||||
children: ReactNode
|
||||
}) {
|
||||
// 语义 active → 导航 key:learn 页归入 tutorial 分块(高亮分块与行首,不选中任何条目)
|
||||
@@ -103,7 +106,9 @@ export function Page({
|
||||
<SiteNavbar
|
||||
brand={{ key: 'index', label: 'idealjs stack', href: '/index.html' }}
|
||||
sections={NAV_SECTIONS}
|
||||
rows={NAV_ROWS}
|
||||
rows={navigation === 'section'
|
||||
? NAV_ROWS.filter((row) => row.sectionKey === activeKey || row.items.some((item) => item.key === activeKey))
|
||||
: NAV_ROWS}
|
||||
active={activeKey}
|
||||
viewTransitionName="site-header"
|
||||
/>
|
||||
@@ -142,9 +147,9 @@ export function Page({
|
||||
)
|
||||
}
|
||||
|
||||
export function Section({ label, note, children }: { label: string; note?: string; children: ReactNode }) {
|
||||
export function Section({ label, note, id, className = '', children }: { label: string; note?: string; id?: string; className?: string; children: ReactNode }) {
|
||||
return (
|
||||
<section className="mb-8">
|
||||
<section id={id} className={`mb-8 ${className}`}>
|
||||
<h2 className="mb-2.5 flex flex-wrap items-baseline gap-2">
|
||||
<span className="t-small-strong">{label}</span>
|
||||
{note && <i className="t-small-mute not-italic">{note}</i>}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/** idealjs stack 首页:三段文案,各带一个入口按钮(学习 / 博客 / 敬请期待)。 */
|
||||
/** idealjs stack 首页:教程、博客与浏览器练习场入口。 */
|
||||
import { Page } from '../../lib/ui'
|
||||
import { Button } from '@stack/design-system'
|
||||
import { MONTHS } from '../../content/blogs'
|
||||
@@ -22,10 +22,10 @@ export function App() {
|
||||
)}
|
||||
</div>
|
||||
<p className="mb-0 mt-7 text-content">
|
||||
未来,我们还将推出在线 Agent 编辑器,让你在浏览器中与 AI 一起编写、运行和改进代码。
|
||||
在浏览器练习场中,通过 WebContainer 运行工程,与 Agent 一起编写、运行和改进代码。
|
||||
</p>
|
||||
<div className="mt-2.5">
|
||||
<Button disabled>Agent 编辑器 · 敬请期待</Button>
|
||||
<Button tone="clash2b" href="/practice.html">打开在线练习场</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Page>
|
||||
|
||||
@@ -1,83 +1,64 @@
|
||||
/** 教程首页——首屏到第二屏回答读者的五个问题(OUTLINE-v2.md §1):
|
||||
* 做什么(终点先行)→ 用什么(积木清单)→ 在哪练(两条路线)→ 要多久(时间便签)→ 凭什么(数据控制)。
|
||||
*
|
||||
* 组件组合:ExperimentFrame(成品预览)+ BrickToolbox(积木三句话)+
|
||||
* ComparisonBoard(环境两条路线对照)+ StickyNote(时间便签)+ Scatter(形状点缀,种子化)。
|
||||
*
|
||||
* 个人中心(后期上线)预留的接缝:
|
||||
* - 英雄区 CTA 的「个人中心」用 disabled Button 占位(虚线占位·不动不起),上线后替换为链接(进度/任务/Key 管理);
|
||||
* - 积木清单的 learned 字段目前恒为 false,后期由个人中心的学习进度驱动。 */
|
||||
/** 课程概览:成品 → 时间与主线 → 技术积木 → 练习环境。 */
|
||||
import { Page, Section } from '../../lib/ui'
|
||||
import { Button, BrickToolbox, ComparisonBoard, ExperimentFrame, Mark, Scatter, StickyNote } from '@stack/design-system'
|
||||
import { BrickDot, Cross, Ring, Tremble, Tri, Wave } from '@stack/design-system'
|
||||
import { Button, BrickToolbox, ComparisonBoard, ExperimentFrame, Mark, StickyNote } from '@stack/design-system'
|
||||
import type { ToolboxBrick } from '@stack/design-system'
|
||||
import { TodoMock } from './components/TodoMock'
|
||||
import { TodoPreview } from './components/TodoPreview'
|
||||
import './learn.css'
|
||||
|
||||
/** 积木清单——从全局靶子倒推,只列用到的;三句话口径见 ai-era-tutorial skill。
|
||||
* learned 后期由个人中心进度驱动,此处先恒为待学。 */
|
||||
const BRICKS: readonly ToolboxBrick[] = [
|
||||
{
|
||||
id: 'html',
|
||||
name: 'HTML 骨架与标签',
|
||||
what: '浏览器页面的结构语言:三件套骨架,加标题、列表、按钮这些零件标签。',
|
||||
why: '第 3 章起你写的每层界面都由它撑起——todolist 的骨架就是一张列表。',
|
||||
family: '标签一族(语义/表单/媒体)——要「结构」找标签,要「行为」找 JS。',
|
||||
id: 'html', name: 'HTML', stage: '基础页面', summary: '搭出输入框、列表和按钮。',
|
||||
what: '描述网页结构的标记语言。标签告诉浏览器哪些是标题、表单和列表。',
|
||||
why: '为待办应用搭出结构,让每一项数据都有展示的位置。',
|
||||
family: '语义标签与表单元素。样式交给 CSS,交互交给 JavaScript。',
|
||||
},
|
||||
{
|
||||
id: 'dom',
|
||||
name: 'DOM 操作',
|
||||
what: '浏览器把页面开放给 JS 的操作口:查到元素、改它、增删它。',
|
||||
why: '第 3 章你靠它亲手把数组重画成界面——这是理解框架「替你做了什么」的前提。',
|
||||
family: '界面操作一族(原生 DOM / 框架虚拟 DOM)——框架只改变「谁来操作」,口子本身不变。',
|
||||
id: 'css', name: 'CSS', stage: '基础页面', summary: '控制布局、颜色和完成样式。',
|
||||
what: '描述页面外观的样式语言,通过选择器匹配需要设置样式的元素。',
|
||||
why: '排列待办条目,为已完成的任务显示删除线,并适配不同屏幕。',
|
||||
family: '选择器、Flexbox、Grid;Tailwind CSS 是组织样式的另一种方式。',
|
||||
},
|
||||
{
|
||||
id: 'js',
|
||||
name: 'JS(变量/数组/事件)',
|
||||
what: '页面的行为语言:数据住在变量里、待办清单是数组、用户动作是事件。',
|
||||
why: 'todolist 的增删全靠它——「数据控制」的起点。',
|
||||
family: '编程语言一族(JS/TS)——TS 只是把「说清楚」变成硬约束。',
|
||||
id: 'js', name: 'JavaScript', stage: '基础交互', summary: '响应操作,修改待办数据。',
|
||||
what: '处理数据与交互的编程语言。DOM 是 JavaScript 读取和修改页面的接口。',
|
||||
why: '用数组存放待办,响应添加、删除和勾选,再把变化呈现在页面上。',
|
||||
family: '变量、数组、事件与 DOM 操作。这些基础也会用于 React 版本。',
|
||||
},
|
||||
{
|
||||
id: 'css',
|
||||
name: 'CSS(内联/文件/选择器)',
|
||||
what: '界面的样式语言:内联与样式文件两种形式,选择器决定命中谁。',
|
||||
why: '第 3 章给 todolist 穿衣服,并讲清两种形式的工程分界。',
|
||||
family: '样式组织一族(原生 CSS / Tailwind / CSS-in-JS)——第 4 章的 Tailwind 是同一问题的另一种答案。',
|
||||
id: 'react', name: 'React', stage: '组件与数据流', summary: '用组件和状态组织界面。',
|
||||
what: '构建用户界面的库。组件描述界面,state 保存状态,props 把数据和回调传给子组件。',
|
||||
why: '把待办拆成输入区、列表和条目。更新状态后,由 React 更新对应界面。',
|
||||
family: '组件、state、props 与状态提升;共享的数据由共同的父组件管理。',
|
||||
},
|
||||
{
|
||||
id: 'react',
|
||||
name: 'React 组件与 state',
|
||||
what: '把界面拆成零件;数据一变,界面自动跟着变。',
|
||||
why: '第 4 章用它重写第 3 章的 todolist——手动重绘消失,数据控制升级成声明。',
|
||||
family: '前端框架一族(React/Vue/Svelte)——学的是「声明式」这个共性,换框架不难。',
|
||||
id: 'ts', name: 'TypeScript', stage: '类型检查', summary: '明确每条待办的数据结构。',
|
||||
what: '为 JavaScript 增加类型检查的语言,在运行前发现部分代码错误。',
|
||||
why: '写清待办的 id、文字和完成状态,检查字段名或数据类型是否用错。',
|
||||
family: '接口、联合类型与类型推断;类型检查与运行时的数据校验各有职责。',
|
||||
},
|
||||
{
|
||||
id: 'props',
|
||||
name: 'props(父子数据流)',
|
||||
what: '父组件把数据递给子组件的通道:数据向下、事件向上。',
|
||||
why: '待办拆成输入条/清单/条目之后,「数据住谁家」靠它回答。',
|
||||
family: '组件通信一族(props/上下文/状态库)——先精通 props,再谈别的。',
|
||||
id: 'tailwind', name: 'Tailwind CSS', stage: '样式组织', summary: '用工具类组合界面样式。',
|
||||
what: '提供 CSS 工具类的样式框架,把常用样式组合在元素的 class 中。',
|
||||
why: '用另一种方式实现同一个待办界面,对比工具类和样式文件的取舍。',
|
||||
family: '原生 CSS、工具类与组件样式;都需要理解布局和 CSS 的基础规则。',
|
||||
},
|
||||
{
|
||||
id: 'ts',
|
||||
name: 'TypeScript 类型',
|
||||
what: '给数据定型的语言:Todo 长什么样写清楚,拼错字段编译期就报错。',
|
||||
why: '第 4 章给待办数据定型——agent 给的代码里这类错误从此瞒不过你。',
|
||||
family: '类型系统一族(TS/JSDoc)——JS 的超集,可以渐进采用。',
|
||||
id: 'vite', name: 'Vite', stage: '运行与构建', summary: '运行工程,生成部署产物。',
|
||||
what: '提供开发服务器和构建能力的工具。开发时预览修改,构建时生成发布文件。',
|
||||
why: '跑起待办工程,并看懂源码怎样变成可部署的 HTML、CSS 和 JavaScript。',
|
||||
family: 'Node.js、npm、开发服务器与构建产物;区分开发环境和发布环境。',
|
||||
},
|
||||
{
|
||||
id: 'tailwind',
|
||||
name: 'TailwindCSS 工具类',
|
||||
what: '把样式写成 class 名的工具类方案。',
|
||||
why: '第 4 章用它复刻第 3 章的样式——同一个问题的工程化答案。',
|
||||
family: '样式方案一族(原子类/语义类/CSS-in-JS)——取舍在于「写在哪、怎么复用」。',
|
||||
id: 'api', name: 'HTTP / API', stage: '前后端连接', summary: '让浏览器与服务端交换数据。',
|
||||
what: 'HTTP 是请求与响应的通信协议,API 约定应用如何读取和修改数据。',
|
||||
why: '把添加、删除和勾选待办变成服务端请求,并处理返回结果。',
|
||||
family: '请求方法、JSON、状态码与服务端校验。',
|
||||
},
|
||||
{
|
||||
id: 'vite',
|
||||
name: 'Vite 开发服务器与构建',
|
||||
what: '本地秒开的热更新服务器,加上把源码打包成可部署产物的构建器。',
|
||||
why: '第 2 章起你天天用它跑工程;第 4 章解剖它的产物。',
|
||||
family: '构建工具一族(Vite/webpack/esbuild)——它是工程的地基,属于认知基础。',
|
||||
id: 'database', name: 'SQLite / Prisma', stage: '数据保存', summary: '保存待办,刷新后仍能读取。',
|
||||
what: 'SQLite 是数据库;Prisma 帮助代码按约定的数据结构读写数据库。',
|
||||
why: '让服务端保存待办数据,浏览器重新打开时通过 API 读取。',
|
||||
family: '数据模型、数据库迁移与持久化;界面状态和长期保存的数据需要配合。',
|
||||
},
|
||||
]
|
||||
|
||||
@@ -85,124 +66,89 @@ export function App() {
|
||||
return (
|
||||
<Page
|
||||
active="learn"
|
||||
navigation="section"
|
||||
title="全栈教程"
|
||||
desc="从第一个网页到行业标配框架——同一支 todolist,逐层重写。终点先行:先看清楚要做出什么,再出发。"
|
||||
desc="从第一个网页到前后端协作,用同一个待办应用串起整个过程。"
|
||||
>
|
||||
{/* 1.1 做什么:终点先行 */}
|
||||
<Section label="终点先行" note="学完这门教程,你将亲手做出并看懂右边这个东西">
|
||||
<div className="relative">
|
||||
{/* 形状点缀:散在内容盒附近的空当里,种子固定、基线可测 */}
|
||||
<Scatter
|
||||
seed={11}
|
||||
shapes={[
|
||||
<Tri size={20} />,
|
||||
<Ring size={18} />,
|
||||
<Wave size={28} />,
|
||||
<span className="flex gap-1">
|
||||
<BrickDot on />
|
||||
<BrickDot />
|
||||
</span>,
|
||||
<Cross size={16} />,
|
||||
<Tremble size={20} />,
|
||||
]}
|
||||
/>
|
||||
<div className="relative grid items-start gap-8 lg:grid-cols-[minmax(0,1fr)_360px]">
|
||||
<div data-comp="hero-copy" className="min-w-0">
|
||||
<p className="m-0 text-content leading-relaxed text-body">
|
||||
<b className="text-ink">目标</b>:做出一个你自己天天会用的<b className="text-ink">单人版 todolist</b>
|
||||
——你负责指挥 agent 与逐条核对,长出识别力。
|
||||
</p>
|
||||
<p className="mb-0 mt-3 text-content leading-relaxed text-body">
|
||||
<b className="text-ink">预期结果</b>:待办可增删、可勾选完成,界面即时跟随数据变化;
|
||||
同一份功能经历五次重写(HTML → JS → CSS → React → React + TS + Tailwind),
|
||||
你能对照任意两个版本,指出这一层替你做了什么。
|
||||
</p>
|
||||
<div className="mt-5 flex flex-wrap items-center gap-3">
|
||||
<Button tone="clash1b" href="/practice.html">
|
||||
直接开练 · 去练习场
|
||||
</Button>
|
||||
<Button href="#bricks">先看用什么</Button>
|
||||
{/* 个人中心:后期上线后替换为链接(进度/任务/Key 管理),此前保持虚线占位 */}
|
||||
<Button disabled>个人中心 · 敬请期待</Button>
|
||||
</div>
|
||||
</div>
|
||||
<ExperimentFrame
|
||||
title="单人版 TodoList"
|
||||
address="localhost:5173"
|
||||
status="running"
|
||||
caption="终点示意 · 静态预览"
|
||||
className="w-full max-w-[360px] justify-self-start lg:justify-self-end"
|
||||
>
|
||||
<TodoMock />
|
||||
</ExperimentFrame>
|
||||
</div>
|
||||
<section className="learn-hero" aria-labelledby="learn-goal">
|
||||
<div className="learn-hero-copy">
|
||||
<h2 id="learn-goal">做一个自己的待办清单</h2>
|
||||
<p>
|
||||
学完做出一个<b>单人版 TodoList</b>:添加、删除、勾选完成,界面随数据更新;
|
||||
接上 API 和数据库后,刷新页面,待办仍然保留。
|
||||
</p>
|
||||
<p className="learn-hero-meta">
|
||||
主线:<a href="#data-control">数据控制</a><span aria-hidden="true"> · </span>通读约 60–90 分钟
|
||||
</p>
|
||||
</div>
|
||||
<ExperimentFrame title="你的待办应用" address={null} status="demo" caption="刷新后重置" className="learn-preview">
|
||||
<TodoPreview />
|
||||
</ExperimentFrame>
|
||||
<div className="learn-hero-actions">
|
||||
<Button tone="clash1b" href="/ch1.html">从第一个网页开始 <span aria-hidden="true">→</span></Button>
|
||||
<Button href="/practice.html">打开练习场</Button>
|
||||
<p>你提出需求,Agent 协助实现;再对照结果,理解代码为什么这样工作。</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div className="learn-overview">
|
||||
<section id="data-control" className="learn-core" aria-labelledby="learn-core-title">
|
||||
<h2 id="learn-core-title">全栈的核心:<Mark>数据控制</Mark></h2>
|
||||
<p>数据由谁管理、怎样变化、如何保存,又怎样呈现在界面上?这是贯穿教程的主线。</p>
|
||||
<ol className="learn-data-flow" aria-label="一次勾选操作的数据流">
|
||||
<li><b>用户操作</b><span>勾选一条待办</span></li>
|
||||
<li><b>更新数据</b><span>修改完成状态</span></li>
|
||||
<li><b>更新界面</b><span>显示勾选和删除线</span></li>
|
||||
<li><b>保存数据</b><span>通过 API 写入数据库</span></li>
|
||||
</ol>
|
||||
<p className="learn-core-note">前端让数据可见、可操作;后端校验并保存数据。先理解这条流向,再逐步加入框架和工具。</p>
|
||||
</section>
|
||||
<StickyNote title="要多久" tone="teal" size="compact">
|
||||
<dl className="learn-time-list">
|
||||
<div><dt>通读主线</dt><dd>60–90 分钟</dd></div>
|
||||
<div><dt>边读边练</dt><dd>4–6 小时</dd></div>
|
||||
<div><dt>本地环境搭建</dt><dd>30–60 分钟</dd></div>
|
||||
</dl>
|
||||
<p className="learn-time-note">时间为预估。跟练不含本地搭建,建议分 2–3 次完成;通读不含拓展阅读。</p>
|
||||
</StickyNote>
|
||||
</div>
|
||||
|
||||
<Section id="bricks" className="learn-section" label="用哪些技术" note="先学页面与交互,再组织工程,最后连接并保存数据。">
|
||||
<BrickToolbox title="项目里的技术积木" variant="overview" bricks={BRICKS} />
|
||||
<p className="learn-section-note">先看每块积木的用途,需要时展开详情。我们逐步完善同一个应用,再用 React、TypeScript 和 Tailwind CSS 改写它。</p>
|
||||
</Section>
|
||||
|
||||
{/* 1.2 用什么:积木清单 */}
|
||||
<Section label="用什么" note="从终点倒推的积木清单,只列用到的;点开看每块的三句话" >
|
||||
<div id="bricks" className="scroll-mt-40">
|
||||
<BrickToolbox title="积木清单" bricks={BRICKS} />
|
||||
</div>
|
||||
</Section>
|
||||
|
||||
{/* 1.3 在哪练:两条环境路线 */}
|
||||
<Section label="在哪练" note="两条路线任选其一,产物完全一致,随时可切换">
|
||||
<Section id="environments" className="learn-section" label="在哪里练习" note="浏览器或本地,按你的使用习惯选择。">
|
||||
<ComparisonBoard
|
||||
title="环境 · 两条路线"
|
||||
caption="选顺手的就好,别在选路上花时间。两条路线的差别与搭建细节,见「环境处理和搭建」。"
|
||||
connector="or"
|
||||
left={{
|
||||
label: '线上 playground · 立刻开始',
|
||||
label: '浏览器练习 · 推荐起步',
|
||||
content: (
|
||||
<>
|
||||
<p className="m-0 text-small leading-relaxed text-body">
|
||||
本站自带:浏览器里跑<b className="text-ink">真实工程</b>(WebContainer),陪练 agent
|
||||
已就位——填一个 API key 就能动工,零安装。
|
||||
</p>
|
||||
<p className="mb-0 mt-3">
|
||||
<Button tone="clash2b" href="/practice.html">
|
||||
去练习场
|
||||
</Button>
|
||||
</p>
|
||||
<dl className="learn-environment-list">
|
||||
<div><dt>运行项目</dt><dd>本站的 WebContainer 在浏览器里运行工程,无需本地安装开发工具。</dd></div>
|
||||
<div><dt>协助实现</dt><dd>Agent Playground 根据你的要求修改代码、执行命令,你通过预览检查结果。</dd></div>
|
||||
</dl>
|
||||
<p className="learn-environment-note">使用 Agent 前配置模型 API Key;项目环境会自动启动。</p>
|
||||
<Button tone="clash1b" href="/practice.html">打开浏览器练习场</Button>
|
||||
</>
|
||||
),
|
||||
}}
|
||||
right={{
|
||||
label: '本地工程 · 贴近真实',
|
||||
label: '本地开发 · 使用自己的工具',
|
||||
content: (
|
||||
<>
|
||||
<p className="m-0 text-small leading-relaxed text-body">
|
||||
你自己的机器+你自己的 agent:node、编辑器、dev server
|
||||
一样不少。「环境处理和搭建」会带你搭起来,并把这些脚下的地逐一露出来。
|
||||
</p>
|
||||
<p className="mb-0 mt-3 t-small-mute">该章排期实现中——先把练习场跑起来不亏。</p>
|
||||
<dl className="learn-environment-list">
|
||||
<div><dt>运行项目</dt><dd>在自己的电脑上准备 Node.js、编辑器和终端,运行开发服务器。</dd></div>
|
||||
<div><dt>协助实现</dt><dd>使用你熟悉的 Agent 修改项目,并在本地浏览器里检查页面和数据变化。</dd></div>
|
||||
</dl>
|
||||
<p className="learn-environment-note">首次搭建预留 30–60 分钟,从「快速开始」查看环境准备。</p>
|
||||
<Button href="/ch1.html">查看本地环境准备</Button>
|
||||
</>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
</Section>
|
||||
|
||||
{/* 1.4 要多久:时间便签 */}
|
||||
<Section label="要多久" note="预估——按「通读 / 跟练 / 分几次」给数,卡住就问你的 agent">
|
||||
<StickyNote title="时间投入便签" tone="teal" className="max-w-[520px]">
|
||||
<ul className="m-0 flex list-none flex-col gap-1 p-0 text-small leading-relaxed text-body">
|
||||
<li>纯通读:约 <b className="text-ink">1–1.5 小时</b>;</li>
|
||||
<li>边读边跟练:约 <b className="text-ink">4–6 小时</b>,分 2–3 次为宜;</li>
|
||||
<li>环境搭建:一次性 <b className="text-ink">30 分钟–1 小时</b>。</li>
|
||||
</ul>
|
||||
</StickyNote>
|
||||
</Section>
|
||||
|
||||
{/* 1.5 凭什么:全栈的核心——数据控制 */}
|
||||
<Section label="凭什么 · 全栈的核心" note="这条线贯穿全部章节,学完回头看,每一层都在做同一件事">
|
||||
<p className="m-0 max-w-[72ch] text-content leading-relaxed text-body">
|
||||
界面是数据的影子。全栈要做的事只有一件:
|
||||
<Mark>让数据听你的,让界面跟着数据走</Mark>
|
||||
——谁拥有数据、数据怎么变、变化怎么走到屏幕上。这支 todolist 会陪你把这条路走一遍:
|
||||
先用 JS <b className="text-ink">亲手</b>重画(第 3 章),再交给 React <b className="text-ink">声明</b>(第 4 章),
|
||||
再用 TS 给数据<b className="text-ink">定型</b>,最后回答数据<b className="text-ink">住在哪里</b>。
|
||||
</p>
|
||||
</Section>
|
||||
</Page>
|
||||
)
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/** 终点示意——单人版 todolist 的静态成品预览(非交互)。
|
||||
* 放在教程首页英雄区,让读者第一眼看到学完后做出来的东西。 */
|
||||
|
||||
const ITEMS = [
|
||||
{ text: '给陪练 agent 填 API Key', done: true },
|
||||
{ text: '把 hello world 跑起来', done: false },
|
||||
{ text: '给待办加一条筛选', done: false },
|
||||
]
|
||||
|
||||
export function TodoMock() {
|
||||
return (
|
||||
<div aria-label="todolist 成品示意(静态预览)" className="flex h-full flex-col gap-2.5 bg-paper p-3 text-left">
|
||||
<div className="flex items-baseline justify-between">
|
||||
<b className="text-content font-extrabold text-ink">今天</b>
|
||||
<span className="t-small-mute font-mono">3 件 · 完成 1</span>
|
||||
</div>
|
||||
{/* 输入条:虚线框=待你实现 */}
|
||||
<div className="flex items-center gap-2 rounded-lg border-2 border-dashed border-ink/40 px-2.5 py-1.5">
|
||||
<span className="flex-1 t-small-mute">加一件待办…</span>
|
||||
<span
|
||||
aria-hidden
|
||||
className="flex size-5 items-center justify-center rounded-md border-2 border-ink bg-clash1b text-[13px] font-extrabold leading-none text-ink"
|
||||
>
|
||||
+
|
||||
</span>
|
||||
</div>
|
||||
<ul className="m-0 flex list-none flex-col gap-1.5 p-0">
|
||||
{ITEMS.map((item) => (
|
||||
<li key={item.text} className="flex items-center gap-2 rounded-lg border-2 border-ink bg-white px-2.5 py-1.5">
|
||||
<span
|
||||
aria-hidden
|
||||
className={`flex size-5 shrink-0 items-center justify-center rounded-md border-2 border-ink text-[12px] font-extrabold leading-none ${
|
||||
item.done ? 'bg-ink text-paper' : 'bg-paper text-transparent'
|
||||
}`}
|
||||
>
|
||||
✓
|
||||
</span>
|
||||
<span className={`flex-1 text-small font-bold ${item.done ? 'text-mute line-through' : 'text-ink'}`}>
|
||||
{item.text}
|
||||
</span>
|
||||
<span aria-hidden className="t-small-mute font-mono">
|
||||
×
|
||||
</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/** 页面内成品演示:只展示增删和状态变化,刷新后回到初始示例。 */
|
||||
import { useRef, useState } from 'react'
|
||||
|
||||
const INITIAL_ITEMS = [
|
||||
{ id: 1, text: '读十页书', done: true },
|
||||
{ id: 2, text: '买牛奶', done: false },
|
||||
]
|
||||
|
||||
export function TodoPreview() {
|
||||
const [items, setItems] = useState(INITIAL_ITEMS)
|
||||
const [draft, setDraft] = useState('')
|
||||
const nextId = useRef(3)
|
||||
const inputRef = useRef<HTMLInputElement>(null)
|
||||
|
||||
return (
|
||||
<div className="learn-todo" role="group" aria-label="待办应用演示">
|
||||
<div className="learn-todo-heading">
|
||||
<b>今天</b>
|
||||
<span role="status">{items.length} 件 · 完成 {items.filter((item) => item.done).length}</span>
|
||||
</div>
|
||||
<form className="learn-todo-input" onSubmit={(event) => {
|
||||
event.preventDefault()
|
||||
const text = draft.trim()
|
||||
if (!text) return
|
||||
const id = nextId.current++
|
||||
setItems((current) => [...current, { id, text, done: false }])
|
||||
setDraft('')
|
||||
inputRef.current?.focus()
|
||||
}}>
|
||||
<label className="sr-only" htmlFor="todo-preview-input">新的待办</label>
|
||||
<input id="todo-preview-input" ref={inputRef} value={draft} onChange={(event) => setDraft(event.target.value)} maxLength={80} placeholder="添加一件待办…" autoComplete="off" />
|
||||
<button type="submit" aria-label="添加待办">+</button>
|
||||
</form>
|
||||
<ul className="learn-todo-items">
|
||||
{items.map((item) => (
|
||||
<li key={item.id}>
|
||||
<label>
|
||||
<input type="checkbox" checked={item.done} onChange={() => {
|
||||
setItems((current) => current.map((todo) => todo.id === item.id ? { ...todo, done: !todo.done } : todo))
|
||||
}} />
|
||||
<span>{item.text}</span>
|
||||
</label>
|
||||
<button type="button" aria-label={`删除${item.text}`} onClick={() => {
|
||||
setItems((current) => current.filter((todo) => todo.id !== item.id))
|
||||
inputRef.current?.focus()
|
||||
}}>×</button>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
{items.length === 0 && <p className="learn-todo-empty">清单空了,添加一件想做的事吧。</p>}
|
||||
<p className="learn-todo-hint">试着勾选一项,看看界面和计数怎样变化。</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
.learn-hero { display: grid; gap: 20px 40px; margin-bottom: 32px; }
|
||||
.learn-hero h2, .learn-core h2 { margin: 0; color: var(--color-ink); font-size: var(--text-t2); font-weight: 800; line-height: 1.45; }
|
||||
.learn-hero-copy > p { margin: 12px 0 0; max-width: 56ch; line-height: 1.75; }
|
||||
.learn-hero-copy b { color: var(--color-ink); }
|
||||
.learn-hero-copy .learn-hero-meta { margin-top: 14px; color: var(--color-body); font-size: 13px; }
|
||||
.learn-hero-meta a { color: var(--color-ink); font-weight: 800; text-underline-offset: 3px; }
|
||||
.learn-preview { width: 100%; max-width: 400px; }
|
||||
.learn-hero-actions { display: flex; flex-wrap: wrap; align-content: start; align-items: center; gap: 12px; }
|
||||
.learn-hero-actions p { flex-basis: 100%; width: 100%; margin: 2px 0 0; color: var(--color-body); font-size: 13px; line-height: 1.7; }
|
||||
.learn-overview { display: grid; gap: 28px; align-items: start; margin-bottom: 36px; }
|
||||
.learn-core { min-width: 0; scroll-margin-top: 24px; }
|
||||
.learn-core h2 { font-size: var(--text-t3); }
|
||||
.learn-core > p { margin: 12px 0; font-size: 14px; line-height: 1.75; }
|
||||
.learn-core .learn-core-note { margin-bottom: 0; color: var(--color-body); font-size: 13px; }
|
||||
.learn-data-flow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; list-style: none; padding: 0; margin: 16px 0; counter-reset: learn-data-step; }
|
||||
.learn-data-flow li { min-width: 0; padding: 10px 12px; border-left: 3px solid var(--color-clash2b); background: var(--color-paper-deep); }
|
||||
.learn-data-flow b, .learn-data-flow span { display: block; }
|
||||
.learn-data-flow b { color: var(--color-ink); font-size: 13px; }
|
||||
.learn-data-flow b::before { counter-increment: learn-data-step; content: counter(learn-data-step) '. '; }
|
||||
.learn-data-flow span { margin-top: 3px; font-size: 12px; overflow-wrap: anywhere; }
|
||||
.learn-time-list { margin: 0; }
|
||||
.learn-time-list > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; margin-bottom: 8px; font-size: 13px; }
|
||||
.learn-time-list dt { color: var(--color-body); }
|
||||
.learn-time-list dd { margin: 0; font-weight: 800; }
|
||||
.learn-time-note { margin: 12px 0 0; color: var(--color-body); font-size: 12px; line-height: 1.7; }
|
||||
.learn-section { scroll-margin-top: 24px; }
|
||||
.learn-section > h2 { gap: 6px 14px; margin: 0 0 16px; }
|
||||
.learn-section > h2 .t-small-strong { font-size: var(--text-t3); }
|
||||
.learn-section-note { margin: 14px 0 0; max-width: 80ch; color: var(--color-body); font-size: 13px; line-height: 1.75; }
|
||||
.learn-environment-list { margin: 0; }
|
||||
.learn-environment-list > div { margin-bottom: 12px; }
|
||||
.learn-environment-list dt { margin-bottom: 3px; color: var(--color-ink); font-size: 13px; font-weight: 800; }
|
||||
.learn-environment-list dd { margin: 0; color: var(--color-body); font-size: 13px; line-height: 1.75; }
|
||||
.learn-environment-note { color: var(--color-body); font-size: 12px; line-height: 1.7; }
|
||||
.learn-todo { display: flex; flex-direction: column; gap: 12px; text-align: left; }
|
||||
.learn-todo-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; }
|
||||
.learn-todo-heading b { font-size: 17px; }
|
||||
.learn-todo-heading [role='status'] { color: var(--color-body); font-size: 12px; }
|
||||
.learn-todo-input { display: flex; gap: 8px; }
|
||||
.learn-todo-input input { width: 100%; min-width: 0; min-height: 40px; padding: 8px 10px; border: 2px solid var(--color-ink); border-radius: 6px; background: var(--color-paper); color: var(--color-ink); font: inherit; font-size: 13px; }
|
||||
.learn-todo-input button { flex-shrink: 0; width: 40px; min-height: 40px; border: 2px solid var(--color-ink); border-radius: 6px; background: var(--color-clash1b); color: var(--color-ink); font-size: 22px; font-weight: 800; cursor: pointer; }
|
||||
.learn-todo-items { display: flex; flex-direction: column; gap: 8px; list-style: none; padding: 0; margin: 0; }
|
||||
.learn-todo-items li { display: flex; align-items: center; gap: 4px; border: 2px solid var(--color-ink); border-radius: 6px; background: var(--color-paper); }
|
||||
.learn-todo-items label { display: flex; flex: 1; align-items: center; gap: 10px; min-width: 0; min-height: 40px; padding: 6px 10px; cursor: pointer; }
|
||||
.learn-todo-items input { flex-shrink: 0; width: 18px; height: 18px; margin: 0; accent-color: var(--color-ink); }
|
||||
.learn-todo-items label span { min-width: 0; color: var(--color-ink); font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
|
||||
.learn-todo-items input:checked + span { color: var(--color-mute); text-decoration: line-through; }
|
||||
.learn-todo-items button { flex-shrink: 0; align-self: stretch; width: 36px; border: 0; border-radius: 4px; background: transparent; color: var(--color-body); font-size: 20px; cursor: pointer; }
|
||||
.learn-todo-items button:hover { background: var(--color-paper-deep); color: var(--color-ink); }
|
||||
.learn-todo-hint, .learn-todo-empty { margin: 0; color: var(--color-body); font-size: 12px; line-height: 1.65; }
|
||||
@media (min-width: 768px) {
|
||||
.learn-hero { grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); grid-template-rows: max-content 1fr; }
|
||||
.learn-preview { grid-column: 2; grid-row: 1 / 3; justify-self: end; }
|
||||
.learn-hero-actions { grid-column: 1; }
|
||||
.learn-overview { grid-template-columns: minmax(0, 1fr) minmax(270px, 320px); gap: 32px; }
|
||||
}
|
||||
@media (min-width: 1024px) {
|
||||
.learn-data-flow { grid-template-columns: repeat(4, minmax(0, 1fr)); }
|
||||
}
|
||||
@@ -5,30 +5,35 @@ export interface ToolboxBrick {
|
||||
why: string
|
||||
family: string
|
||||
learned?: boolean
|
||||
/** 课程概览直接展示用途与阶段;章节工具盒继续展示学习进度。 */
|
||||
summary?: string
|
||||
stage?: string
|
||||
}
|
||||
|
||||
export interface BrickToolboxProps {
|
||||
title: string
|
||||
bricks: readonly ToolboxBrick[]
|
||||
variant?: 'lesson' | 'overview'
|
||||
className?: string
|
||||
}
|
||||
|
||||
export function BrickToolbox({ title, bricks, className = '' }: BrickToolboxProps) {
|
||||
export function BrickToolbox({ title, bricks, variant = 'lesson', className = '' }: BrickToolboxProps) {
|
||||
return (
|
||||
<section data-comp="brick-toolbox" className={`learning-object learning-toolbox ${className}`}>
|
||||
<section data-comp="brick-toolbox" data-variant={variant} className={`learning-object learning-toolbox ${className}`}>
|
||||
<header><span aria-hidden="true">● ● ●</span><h3>{title}</h3><small>{bricks.length} 块</small></header>
|
||||
<div className="learning-toolbox-tray">
|
||||
{bricks.map((brick, index) => (
|
||||
<details key={brick.id} className="learning-brick">
|
||||
<summary>
|
||||
<span className="learning-brick-studs" aria-hidden="true"><i /><i /></span>
|
||||
<span className="learning-eyebrow">{String(index + 1).padStart(2, '0')} / {brick.learned ? '已学' : '待学'}</span>
|
||||
<span className="learning-eyebrow">{variant === 'overview' ? brick.stage : `${String(index + 1).padStart(2, '0')} / ${brick.learned ? '已学' : '待学'}`}</span>
|
||||
<b>{brick.name}</b><span className="learning-brick-open" aria-hidden="true">+</span>
|
||||
{variant === 'overview' && brick.summary && <span className="learning-brick-summary">{brick.summary}</span>}
|
||||
</summary>
|
||||
<dl>
|
||||
<dt>是什么</dt><dd>{brick.what}</dd>
|
||||
<dt>为何在这</dt><dd>{brick.why}</dd>
|
||||
<dt>带一族</dt><dd>{brick.family}</dd>
|
||||
<dt>{variant === 'overview' ? '在项目里做什么' : '为何在这'}</dt><dd>{brick.why}</dd>
|
||||
<dt>{variant === 'overview' ? '相关技术' : '带一族'}</dt><dd>{brick.family}</dd>
|
||||
</dl>
|
||||
</details>
|
||||
))}
|
||||
|
||||
@@ -6,24 +6,26 @@ export interface ComparisonSide {
|
||||
}
|
||||
|
||||
export interface ComparisonBoardProps {
|
||||
title: string
|
||||
title?: string
|
||||
left: ComparisonSide
|
||||
right: ComparisonSide
|
||||
caption?: string
|
||||
/** 对照用双向箭头,互斥的路线选择用“或”。 */
|
||||
connector?: 'compare' | 'or'
|
||||
className?: string
|
||||
}
|
||||
|
||||
export function ComparisonBoard({ title, left, right, caption, className = '' }: ComparisonBoardProps) {
|
||||
export function ComparisonBoard({ title, left, right, caption, connector = 'compare', className = '' }: ComparisonBoardProps) {
|
||||
return (
|
||||
<section data-comp="comparison-board" className={`learning-object learning-comparison ${className}`}>
|
||||
<h3>{title}</h3>
|
||||
{title && <h3>{title}</h3>}
|
||||
<div className="learning-comparison-pages">
|
||||
{[left, right].map((side, index) => (
|
||||
<section key={index} className="learning-comparison-page">
|
||||
<h4>{side.label}</h4><div className="learning-prose">{side.content}</div>
|
||||
</section>
|
||||
))}
|
||||
<span className="learning-comparison-link" aria-hidden="true">↔</span>
|
||||
<span className="learning-comparison-link" data-connector={connector} aria-hidden="true">{connector === 'or' ? '或' : '↔'}</span>
|
||||
</div>
|
||||
{caption && <p className="learning-description">{caption}</p>}
|
||||
</section>
|
||||
|
||||
@@ -2,14 +2,15 @@ import type { ReactNode } from 'react'
|
||||
|
||||
export interface ExperimentFrameProps {
|
||||
title: string
|
||||
address?: string
|
||||
status?: 'ready' | 'running' | 'idle'
|
||||
/** null 用于页面内演示,不显示虚构的工程地址。 */
|
||||
address?: string | null
|
||||
status?: 'ready' | 'running' | 'idle' | 'demo'
|
||||
caption?: string
|
||||
children: ReactNode
|
||||
className?: string
|
||||
}
|
||||
|
||||
const STATUS = { ready: '运行正常', running: '运行中', idle: '未运行' } as const
|
||||
const STATUS = { ready: '运行正常', running: '运行中', idle: '未运行', demo: '可操作演示' } as const
|
||||
|
||||
export function ExperimentFrame({ title, address = 'localhost:3000', status = 'ready', caption, children, className = '' }: ExperimentFrameProps) {
|
||||
return (
|
||||
@@ -18,7 +19,7 @@ export function ExperimentFrame({ title, address = 'localhost:3000', status = 'r
|
||||
<span className="learning-window-dots" aria-hidden="true"><i /><i /><i /></span>
|
||||
<h3>{title}</h3>
|
||||
</header>
|
||||
<div className="learning-address"><span aria-hidden="true">↗</span><code>{address}</code></div>
|
||||
{address !== null && <div className="learning-address"><span aria-hidden="true">↗</span><code>{address}</code></div>}
|
||||
<div className="learning-experiment-screen">{children}</div>
|
||||
<footer>
|
||||
<span className="learning-run-status" data-status={status}><i aria-hidden="true" />{STATUS[status]}</span>
|
||||
|
||||
@@ -6,12 +6,13 @@ export interface StickyNoteProps {
|
||||
title: string
|
||||
children: ReactNode
|
||||
tone?: LearningTone
|
||||
size?: 'default' | 'compact'
|
||||
className?: string
|
||||
}
|
||||
|
||||
export function StickyNote({ title, children, tone = 'yellow', className = '' }: StickyNoteProps) {
|
||||
export function StickyNote({ title, children, tone = 'yellow', size = 'default', className = '' }: StickyNoteProps) {
|
||||
return (
|
||||
<aside data-comp="sticky-note" className={`learning-object learning-note ${className}`} style={toneStyle(tone)}>
|
||||
<aside data-comp="sticky-note" data-size={size} className={`learning-object learning-note ${className}`} style={toneStyle(tone)}>
|
||||
<div className="learning-note-paper">
|
||||
<span className="learning-note-pin" aria-hidden="true" />
|
||||
<h3>{title}</h3>
|
||||
|
||||
@@ -97,6 +97,7 @@
|
||||
.learning-note-paper h3 { margin-bottom: 12px; }
|
||||
.learning-note-pin { position: absolute; left: calc(50% - 6px); top: 10px; width: 12px; height: 12px; border: 2px solid var(--color-ink); border-radius: 50%; background: var(--color-paper); }
|
||||
.learning-note-fold { position: absolute; right: 0; bottom: 0; width: 30px; height: 30px; border-top: 2px solid var(--color-ink); border-left: 2px solid var(--color-ink); background: var(--color-paper-deep); }
|
||||
.learning-note[data-size='compact'] .learning-note-paper { min-height: 0; padding: 30px 20px 28px; }
|
||||
|
||||
/* 04 / 可标记的书签 */
|
||||
.learning-bookmark-shell { width: fit-content; max-width: 100%; filter: drop-shadow(var(--drop-shadow-hard)); }
|
||||
@@ -219,6 +220,18 @@
|
||||
.learning-brick dt { font-weight: 800; }
|
||||
.learning-brick dd { margin: 2px 0 10px; color: var(--color-body); }
|
||||
.learning-brick dd:last-child { margin-bottom: 0; }
|
||||
.learning-toolbox[data-variant='overview'] .learning-toolbox-tray { align-items: start; gap: 22px 16px; padding: 24px 16px 18px; }
|
||||
.learning-toolbox[data-variant='overview'] .learning-brick summary { padding: 10px 12px 12px; }
|
||||
.learning-toolbox[data-variant='overview'] .learning-brick summary b { padding-right: 20px; }
|
||||
.learning-toolbox[data-variant='overview'] .learning-eyebrow { color: var(--color-body); font-size: 10px; letter-spacing: 0; }
|
||||
.learning-brick-summary { display: block; margin-top: 4px; color: var(--color-body); font-size: 12px; line-height: 1.5; }
|
||||
@media (min-width: 360px) {
|
||||
.learning-toolbox[data-variant='overview'] .learning-toolbox-tray { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
||||
.learning-toolbox[data-variant='overview'] .learning-brick[open] { grid-column: 1 / -1; }
|
||||
}
|
||||
@media (min-width: 1024px) {
|
||||
.learning-toolbox[data-variant='overview'] .learning-toolbox-tray { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
||||
}
|
||||
|
||||
/* 11 / 交付装箱单 */
|
||||
.learning-manifest { padding: 20px; border: 2px solid var(--color-ink); border-radius: 3px; background: var(--color-paper); box-shadow: var(--shadow-hard); }
|
||||
@@ -245,6 +258,7 @@
|
||||
.learning-comparison-page h4 { width: fit-content; max-width: 100%; margin: -2px 0 18px -2px; padding: 6px 12px; border: 2px solid var(--color-ink); border-radius: 0 0 5px 5px; background: var(--color-clash1a); font-size: 11px; font-weight: 800; }
|
||||
.learning-comparison-page:nth-child(2) h4 { background: var(--color-clash1b); }
|
||||
.learning-comparison-link { grid-column: 2; grid-row: 1; align-self: center; display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 2px solid var(--color-ink); border-radius: 50%; background: var(--color-paper); font-size: 17px; }
|
||||
.learning-comparison-link[data-connector='or'] { transform: none; font-size: 12px; font-weight: 800; }
|
||||
|
||||
/* 同一份标本供两个组件页复用。 */
|
||||
.learning-gallery { --learning-accent: var(--color-clash2a); }
|
||||
@@ -277,6 +291,7 @@
|
||||
.learning-comparison-page:first-child { grid-column: 1; grid-row: 1; }
|
||||
.learning-comparison-page:nth-child(2) { grid-column: 1; grid-row: 3; }
|
||||
.learning-comparison-link { grid-column: 1; grid-row: 2; justify-self: center; transform: rotate(90deg); }
|
||||
.learning-comparison-link[data-connector='or'] { transform: none; }
|
||||
}
|
||||
@media (max-width: 620px) {
|
||||
.learning-gallery-grid { grid-template-columns: minmax(0, 1fr); gap: 30px; }
|
||||
@@ -285,6 +300,7 @@
|
||||
.learning-comparison-page:first-child { grid-column: 1; grid-row: 1; }
|
||||
.learning-comparison-page:nth-child(2) { grid-column: 1; grid-row: 3; }
|
||||
.learning-comparison-link { grid-column: 1; grid-row: 2; justify-self: center; transform: rotate(90deg); }
|
||||
.learning-comparison-link[data-connector='or'] { transform: none; }
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.learning-action, .learning-bookmark { transition: none; }
|
||||
|
||||
Reference in new issue
Block a user