Footer
包含品牌、链接分组和元信息的站点页脚,文档页脚使用它。
导入
“导入”部分import { Footer, FooterBrand, FooterBrandName, FooterBrandDescription, FooterNav, FooterGroup, FooterGroupLabel, FooterLink, FooterMeta, FooterCopyright,} from "@pelagornis/page/components";示例
“示例”部分上方预览渲染的就是这个文件。把它复制到 src/components/ 即可开始使用。
import { Footer, FooterBrand, FooterBrandDescription, FooterBrandName, FooterCopyright, FooterGroup, FooterGroupLabel, FooterLink, FooterMeta, FooterNav,} from "@pelagornis/page/components";
export default function FooterDemo() { return ( <Footer className="w-full"> <FooterBrand> <FooterBrandName>Page</FooterBrandName> <FooterBrandDescription>A Starlight theme built on RefineUI.</FooterBrandDescription> </FooterBrand> <FooterNav> <FooterGroup> <FooterGroupLabel>Docs</FooterGroupLabel> <FooterLink href="/guides/getting-started/">Getting started</FooterLink> <FooterLink href="/components/">Components</FooterLink> </FooterGroup> <FooterGroup> <FooterGroupLabel>Project</FooterGroupLabel> <FooterLink href="https://github.com/pelagornis/starlight-theme-page">GitHub</FooterLink> </FooterGroup> </FooterNav> <FooterMeta> <FooterCopyright>© Pelagornis</FooterCopyright> </FooterMeta> </Footer> );}在 MDX 中使用
“在 MDX 中使用”部分Footer 由共享 React 状态的多个部件组成。写在 MDX 中的子元素会各自渲染成独立的岛,部件之间无法互通。请像上面的示例一样在 .tsx 文件中组合,再导入该文件。
---title: Example---
import FooterExample from "../../components/FooterExample";
<FooterExample client:load />client:load 会在页面加载时水合该岛。位于页面靠下位置的内容请使用 client:visible。
在 Markdoc 中使用
“在 Markdoc 中使用”部分Markdoc 标签渲染的是 Astro 组件,而这个组件需要客户端状态。请把示例包进一个负责水合的 .astro 文件,再把该文件注册为标签。
---import FooterExample from "../FooterExample";---
<FooterExample client:load />import { component, defineMarkdocConfig } from "@astrojs/markdoc/config";import starlightMarkdoc from "@astrojs/starlight-markdoc";import pageMarkdoc from "@pelagornis/page/markdoc";
export default defineMarkdocConfig({ extends: [starlightMarkdoc(), pageMarkdoc()], tags: { "footer-example": { render: component("./src/components/markdoc/FooterExample.astro"), selfClosing: true, }, },});{% footer-example /%}结构
“结构”部分组件的组成部分,以及每个部分渲染的 data-refineui 角色。
| 部件 | 角色 |
|---|---|
root | footer |
brand | footer-brand |
brand_description | footer-brand-description |
brand_name | footer-brand-name |
copyright | footer-copyright |
explore | footer-explore |
group | footer-group |
group_label | footer-group-label |
link | footer-link |
locale | footer-locale |
logo | footer-logo |
meta | footer-meta |
meta_end | footer-meta-end |
nav | footer-nav |
social | footer-social |
状态
“状态”部分组件会设置样式的状态。组件状态通过 data 属性暴露。
| 类型 | 状态 |
|---|---|
| 伪类 | focus-visible |
参考
“参考”部分- 设计指南和令牌细节见 RefineUI · Footer。
- 通用规则见在 MDX 中使用和在 Markdoc 中使用。