@barodoc/theme-docs 6.0.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/components/Contributors.astro +32 -16
- package/src/components/DocHeader.tsx +29 -1
- package/src/components/Header.astro +1 -0
- package/src/components/MobileNav.astro +2 -0
- package/src/components/MobileNavSheet.tsx +29 -1
- package/src/components/index.ts +1 -0
- package/src/components/mdx/ApiEndpoint.tsx +35 -0
- package/src/components/mdx/ApiPlayground.tsx +650 -61
- package/src/layouts/BlogLayout.astro +16 -2
- package/src/pages/blog/[...slug].astro +1 -0
- package/src/pages/blog/index.astro +12 -1
- package/src/pages/docs/[...slug].astro +1 -1
- package/src/pages/index.astro +18 -4
- package/src/styles/global.css +998 -114
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import BaseLayout from "./BaseLayout.astro";
|
|
3
3
|
import Header from "../components/Header.astro";
|
|
4
4
|
import Banner from "../components/Banner.astro";
|
|
5
|
+
import CodeCopy from "../components/CodeCopy.astro";
|
|
5
6
|
import { defaultLocale } from "virtual:barodoc/i18n";
|
|
6
7
|
import { getLocaleFromPath } from "@barodoc/core";
|
|
7
8
|
|
|
@@ -10,12 +11,13 @@ interface Props {
|
|
|
10
11
|
description?: string;
|
|
11
12
|
date?: Date;
|
|
12
13
|
author?: string;
|
|
14
|
+
avatar?: string;
|
|
13
15
|
image?: string;
|
|
14
16
|
tags?: string[];
|
|
15
17
|
readingTime?: string;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
const { title, description, date, author, image, tags = [], readingTime } = Astro.props;
|
|
20
|
+
const { title, description, date, author, avatar, image, tags = [], readingTime } = Astro.props;
|
|
19
21
|
const currentPath = Astro.url.pathname;
|
|
20
22
|
const i18nConfig = { defaultLocale, locales: [defaultLocale] };
|
|
21
23
|
const currentLocale = getLocaleFromPath(currentPath, i18nConfig);
|
|
@@ -47,7 +49,18 @@ const currentLocale = getLocaleFromPath(currentPath, i18nConfig);
|
|
|
47
49
|
</p>
|
|
48
50
|
)}
|
|
49
51
|
<div class="mt-4 flex items-center gap-3 text-sm text-[var(--bd-text-muted)]">
|
|
50
|
-
{author &&
|
|
52
|
+
{author && (
|
|
53
|
+
<span class="flex items-center gap-2">
|
|
54
|
+
{avatar && (
|
|
55
|
+
<img
|
|
56
|
+
src={avatar}
|
|
57
|
+
alt={author}
|
|
58
|
+
class="w-6 h-6 rounded-full object-cover ring-1 ring-[var(--bd-border)]"
|
|
59
|
+
/>
|
|
60
|
+
)}
|
|
61
|
+
<span>{author}</span>
|
|
62
|
+
</span>
|
|
63
|
+
)}
|
|
51
64
|
{author && date && <span class="text-[var(--bd-border)]">·</span>}
|
|
52
65
|
{date && (
|
|
53
66
|
<time datetime={date.toISOString()}>
|
|
@@ -75,6 +88,7 @@ const currentLocale = getLocaleFromPath(currentPath, i18nConfig);
|
|
|
75
88
|
<div class="prose prose-gray dark:prose-invert max-w-none">
|
|
76
89
|
<slot />
|
|
77
90
|
</div>
|
|
91
|
+
<CodeCopy />
|
|
78
92
|
|
|
79
93
|
<!-- Back to blog -->
|
|
80
94
|
<div class="mt-12 pt-8 border-t border-[var(--bd-border)]">
|
|
@@ -31,6 +31,7 @@ const readTime = readingTime(post.body ?? "");
|
|
|
31
31
|
description={post.data.description || post.data.excerpt}
|
|
32
32
|
date={post.data.date ? new Date(post.data.date) : undefined}
|
|
33
33
|
author={post.data.author}
|
|
34
|
+
avatar={post.data.avatar}
|
|
34
35
|
image={post.data.image}
|
|
35
36
|
tags={post.data.tags}
|
|
36
37
|
readingTime={readTime.text}
|
|
@@ -74,7 +74,18 @@ const sortedPosts = posts.sort((a, b) => {
|
|
|
74
74
|
</p>
|
|
75
75
|
)}
|
|
76
76
|
<div class="mt-auto pt-2 flex items-center gap-2 text-xs text-[var(--bd-text-muted)]">
|
|
77
|
-
{post.data.author &&
|
|
77
|
+
{post.data.author && (
|
|
78
|
+
<span class="flex items-center gap-1.5">
|
|
79
|
+
{post.data.avatar && (
|
|
80
|
+
<img
|
|
81
|
+
src={post.data.avatar}
|
|
82
|
+
alt={post.data.author}
|
|
83
|
+
class="w-4 h-4 rounded-full object-cover"
|
|
84
|
+
/>
|
|
85
|
+
)}
|
|
86
|
+
<span>{post.data.author}</span>
|
|
87
|
+
</span>
|
|
88
|
+
)}
|
|
78
89
|
{post.data.author && post.data.date && <span>·</span>}
|
|
79
90
|
{post.data.date && (
|
|
80
91
|
<time datetime={new Date(post.data.date).toISOString()}>
|
|
@@ -125,7 +125,7 @@ breadcrumbs.push({ label: doc.data.title });
|
|
|
125
125
|
lastUpdated={lastUpdated}
|
|
126
126
|
breadcrumbs={breadcrumbs}
|
|
127
127
|
readingTime={readTime.text}
|
|
128
|
-
filePath={doc.id}
|
|
128
|
+
filePath={`src/content/docs/${doc.id}`}
|
|
129
129
|
>
|
|
130
130
|
{category && (
|
|
131
131
|
<p class="text-xs font-semibold uppercase tracking-widest text-primary-600 dark:text-primary-400 mb-3">
|
package/src/pages/index.astro
CHANGED
|
@@ -43,10 +43,24 @@ const features = [
|
|
|
43
43
|
<header class="sticky top-0 z-50 border-b border-[var(--bd-border)] bg-[var(--bd-bg)]/95 backdrop-blur-md">
|
|
44
44
|
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
|
45
45
|
<div class="flex h-16 items-center justify-between">
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
<div class="flex items-center gap-6">
|
|
47
|
+
<a href="/" class="flex items-center gap-2.5 font-semibold text-[var(--bd-text)]">
|
|
48
|
+
{config.logo && <img src={config.logo} alt={config.name} class="h-7 w-7" />}
|
|
49
|
+
<span class="text-lg">{config.name}</span>
|
|
50
|
+
</a>
|
|
51
|
+
{config.tabs && config.tabs.length > 0 && (
|
|
52
|
+
<nav class="hidden md:flex items-center gap-1">
|
|
53
|
+
{config.tabs.map((tab: { label: string; href: string }) => (
|
|
54
|
+
<a
|
|
55
|
+
href={tab.href}
|
|
56
|
+
class="px-3 py-1.5 text-sm font-medium rounded-lg text-[var(--bd-text-secondary)] hover:text-[var(--bd-text)] hover:bg-[var(--bd-bg-subtle)] transition-colors"
|
|
57
|
+
>
|
|
58
|
+
{tab.label}
|
|
59
|
+
</a>
|
|
60
|
+
))}
|
|
61
|
+
</nav>
|
|
62
|
+
)}
|
|
63
|
+
</div>
|
|
50
64
|
<div class="flex items-center gap-2">
|
|
51
65
|
{config.topbar?.github && (
|
|
52
66
|
<a
|