Part 1

区段组件总览 (Section Components Overview)

AstroGlass 中所有可用区段组件的全面概览。

区段组件 (Section components) 是构建每个主题页面的基本构件。每个主题页面由 12个及以上区段 构成,每个区段在各个主题下都拥有专门的变体设计。

可用区段

运作原理简介

以上每一区块皆相应保有 6种特定的主题变体 —— 即分别对应系统内全部主题 (Liquid, Glass, Neo, Luxury, Minimal, Aurora)。在此之外动态主页面构建文档 src/pages/[theme].astro 便会通过对应组件地图映射表来加载对应确切变体:

---
// 摘自 [theme].astro (简化版)
const componentMap = {
liquid: { Hero: HeroLiquid, About: AboutLiquid, ... },
glass: { Hero: HeroGlass, About: AboutGlass, ... },
// neo, luxury, minimal, aurora...
};
const components = componentMap[themeId];
---
<components.Hero />
<components.About />
<components.Features />
ℹ️
不接受外部 Props 传参

为避免冗余区段组件全面舍弃了采用传入外部 Props 的接口。一切显示文本信息全被内部所调用的 useTranslations() 根据针对相应的 src/locales/{lang}/{section}.json 中配置进行内嵌读取渲染应用呈现出来,因此改写此类具体内容需要直调整更新所针对语言内附文件即可完成操作。

目录及存储结构规范

项目下的所有展现层分区内容都依据了一以贯之的同类文件夹归集布局规范存放:

src/components/sections/{section}/
├── {Section}Liquid.astro
├── {Section}Glass.astro
├── {Section}Neo.astro
├── {Section}Luxury.astro
├── {Section}Minimal.astro
└── {Section}Aurora.astro

每个主题组件对应的具体 CSS 排版样式布局指令文档被分别设立储藏在:src/styles/components/{section}/ 下归档整合调用。