mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 11:29:33 +08:00
feat: add ViewTransitions from Astro
Integrate ViewTransitions API from Astro v3. resolve #96
This commit is contained in:
+23
-4
@@ -1,18 +1,37 @@
|
||||
---
|
||||
import Breadcrumbs from "@components/Breadcrumbs.astro";
|
||||
|
||||
export interface Props {
|
||||
interface StringTitleProp {
|
||||
pageTitle: string;
|
||||
pageDesc?: string;
|
||||
}
|
||||
|
||||
const { pageTitle, pageDesc } = Astro.props;
|
||||
interface ArrayTitleProp {
|
||||
pageTitle: [string, string];
|
||||
titleTransition: string;
|
||||
pageDesc?: string;
|
||||
}
|
||||
|
||||
export type Props = StringTitleProp | ArrayTitleProp;
|
||||
|
||||
const { props } = Astro;
|
||||
---
|
||||
|
||||
<Breadcrumbs />
|
||||
<main id="main-content">
|
||||
<h1>{pageTitle}</h1>
|
||||
<p>{pageDesc}</p>
|
||||
{
|
||||
"titleTransition" in props ? (
|
||||
<h1>
|
||||
{props.pageTitle[0]}
|
||||
<span transition:name={props.titleTransition}>
|
||||
{props.pageTitle[1]}
|
||||
</span>
|
||||
</h1>
|
||||
) : (
|
||||
<h1>{props.pageTitle}</h1>
|
||||
)
|
||||
}
|
||||
<p>{props.pageDesc}</p>
|
||||
<slot />
|
||||
</main>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user