mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-14 21:26:08 +01:00
feat: cleaner api rendering
This commit is contained in:
1 parent
a7bd671309
commit
8b01b7c192
11 files changed
+143
-25
No files matched your search
@@ -0,0 +1,34 @@
|
||||
---
|
||||
import type { CollectionEntry } from "astro:content";
|
||||
import { Code } from "./Code";
|
||||
import { Heading } from "./Heading";
|
||||
import { MarkdownCustom } from "./MarkdownCustom";
|
||||
|
||||
interface Props {
|
||||
apis: CollectionEntry<"api">[];
|
||||
}
|
||||
|
||||
const { apis } = Astro.props;
|
||||
---
|
||||
|
||||
<style>
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-4);
|
||||
}
|
||||
</style>
|
||||
|
||||
{
|
||||
apis
|
||||
.sort((a, b) => a.id.localeCompare(b.id))
|
||||
.map((api) => (
|
||||
<div class="container">
|
||||
<Heading size="3">
|
||||
<Code>{api.id}</Code>
|
||||
</Heading>
|
||||
|
||||
<MarkdownCustom body={api.data.docs ?? ""} />
|
||||
</div>
|
||||
))
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
.markdown {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-4);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import Markdown from "react-markdown";
|
||||
import { Text } from "../Text";
|
||||
import styles from "./index.module.css";
|
||||
|
||||
interface Props {
|
||||
body: string;
|
||||
}
|
||||
|
||||
export function MarkdownCustom({ body }: Props) {
|
||||
return (
|
||||
<div className={styles.markdown}>
|
||||
<Markdown
|
||||
components={{
|
||||
p: Text,
|
||||
}}
|
||||
>
|
||||
{body}
|
||||
</Markdown>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-4);
|
||||
gap: var(--space-5);
|
||||
}
|
||||
|
||||
&[data-first="true"] .content {
|
||||
|
||||
Reference in new issue
Block a user