コンテンツにスキップ
Page

Footer

ブランド、リンクのグループ、メタ情報を持つサイトのフッターです。ドキュメントのフッターはこれを使います。

import {
Footer,
FooterBrand,
FooterBrandName,
FooterBrandDescription,
FooterNav,
FooterGroup,
FooterGroupLabel,
FooterLink,
FooterMeta,
FooterCopyright,
} from "@pelagornis/page/components";

上のプレビューはこのファイルを描画したものです。src/components/ にコピーして使い始めてください。

src/components/FooterExample.tsx
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>
);
}

Footer は React の状態を共有する複数のパーツで構成されます。MDX に書いた子要素はそれぞれ別のアイランドとして描画されるため、パーツ同士がつながりません。上の例のように .tsx ファイルで組み立て、そのファイルをインポートしてください。

src/content/docs/example.mdx
---
title: Example
---
import FooterExample from "../../components/FooterExample";
<FooterExample client:load />

client:load はページの読み込み時にアイランドをハイドレートします。ページの下の方にあるコンテンツには client:visible を使ってください。

Markdoc のタグは Astro コンポーネントを描画しますが、このコンポーネントにはクライアントの状態が必要です。例をハイドレートする .astro ファイルで包み、そのファイルをタグとして登録してください。

src/components/markdoc/FooterExample.astro
---
import FooterExample from "../FooterExample";
---
<FooterExample client:load />
markdoc.config.mjs
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,
},
},
});
src/content/docs/example.mdoc
{% footer-example /%}

コンポーネントを構成するパーツと、それぞれが描画する data-refineui のロールです。

パーツロール
rootfooter
brandfooter-brand
brand_descriptionfooter-brand-description
brand_namefooter-brand-name
copyrightfooter-copyright
explorefooter-explore
groupfooter-group
group_labelfooter-group-label
linkfooter-link
localefooter-locale
logofooter-logo
metafooter-meta
meta_endfooter-meta-end
navfooter-nav
socialfooter-social

コンポーネントがスタイルを当てる状態です。コンポーネントの状態は data 属性として公開されます。

種類状態
疑似クラスfocus-visible