@kurbo/dkit 0.4.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/README.md +24 -0
- package/dist/bin.js +8066 -0
- package/dist/bin.js.map +1 -0
- package/package.json +58 -0
- package/vendor/registry/blocks/blog-detail/module.json +27 -0
- package/vendor/registry/blocks/blog-detail/ui/minimal/next/blog-detail.tsx +26 -0
- package/vendor/registry/blocks/blog-detail/ui/minimal/nuxt/BlogDetail.vue +27 -0
- package/vendor/registry/blocks/blog-detail/ui/shadcn/next/blog-detail.tsx +106 -0
- package/vendor/registry/blocks/blog-detail/ui/shadcn/nuxt/BlogDetail.vue +116 -0
- package/vendor/registry/blocks/blog-list/module.json +26 -0
- package/vendor/registry/blocks/blog-list/ui/minimal/next/blog-list.tsx +130 -0
- package/vendor/registry/blocks/blog-list/ui/minimal/nuxt/BlogList.vue +62 -0
- package/vendor/registry/blocks/blog-list/ui/shadcn/next/blog-list.tsx +109 -0
- package/vendor/registry/blocks/blog-list/ui/shadcn/nuxt/BlogList.vue +100 -0
- package/vendor/registry/blocks/blog-list-cards/module.json +27 -0
- package/vendor/registry/blocks/blog-list-cards/ui/minimal/next/blog-list-cards.tsx +130 -0
- package/vendor/registry/blocks/blog-list-cards/ui/minimal/nuxt/BlogListCards.vue +114 -0
- package/vendor/registry/blocks/blog-list-cards/ui/shadcn/next/blog-list-cards.tsx +119 -0
- package/vendor/registry/blocks/blog-list-cards/ui/shadcn/nuxt/BlogListCards.vue +113 -0
- package/vendor/registry/blocks/booking-form-ui/module.json +15 -0
- package/vendor/registry/blocks/booking-form-ui/ui/minimal/next/booking-form.tsx +89 -0
- package/vendor/registry/blocks/booking-form-ui/ui/shadcn/next/booking-form.tsx +92 -0
- package/vendor/registry/blocks/contact-form-ui/module.json +27 -0
- package/vendor/registry/blocks/contact-form-ui/ui/minimal/next/contact-form.tsx +45 -0
- package/vendor/registry/blocks/contact-form-ui/ui/minimal/nuxt/ContactForm.vue +79 -0
- package/vendor/registry/blocks/contact-form-ui/ui/shadcn/next/contact-form.tsx +55 -0
- package/vendor/registry/blocks/contact-form-ui/ui/shadcn/nuxt/ContactForm.vue +92 -0
- package/vendor/registry/blocks/faq-list/module.json +15 -0
- package/vendor/registry/blocks/faq-list/ui/minimal/next/faq-list.tsx +78 -0
- package/vendor/registry/blocks/faq-list/ui/shadcn/next/faq-list.tsx +77 -0
- package/vendor/registry/blocks/maintenance-gate/module.json +13 -0
- package/vendor/registry/blocks/maintenance-gate/ui/minimal/next/maintenance-gate.tsx +135 -0
- package/vendor/registry/blocks/maintenance-gate/ui/shadcn/next/maintenance-gate.tsx +87 -0
- package/vendor/registry/blocks/nav-footer/module.json +13 -0
- package/vendor/registry/blocks/nav-footer/ui/minimal/next/nav-footer.tsx +55 -0
- package/vendor/registry/blocks/nav-footer/ui/shadcn/next/nav-footer.tsx +41 -0
- package/vendor/registry/blocks/nav-header/module.json +14 -0
- package/vendor/registry/blocks/nav-header/ui/minimal/next/nav-header.tsx +244 -0
- package/vendor/registry/blocks/nav-header/ui/shadcn/next/nav-header-client.tsx +185 -0
- package/vendor/registry/blocks/nav-header/ui/shadcn/next/nav-header.tsx +12 -0
- package/vendor/registry/blocks/page-detail/module.json +26 -0
- package/vendor/registry/blocks/page-detail/ui/minimal/next/page-detail.tsx +26 -0
- package/vendor/registry/blocks/page-detail/ui/minimal/nuxt/PageDetail.vue +26 -0
- package/vendor/registry/blocks/page-detail/ui/shadcn/next/page-detail.tsx +61 -0
- package/vendor/registry/blocks/page-detail/ui/shadcn/nuxt/PageDetail.vue +62 -0
- package/vendor/registry/blocks/project-detail/module.json +15 -0
- package/vendor/registry/blocks/project-detail/ui/minimal/next/project-detail.tsx +58 -0
- package/vendor/registry/blocks/project-detail/ui/shadcn/next/project-detail.tsx +91 -0
- package/vendor/registry/blocks/project-list/module.json +14 -0
- package/vendor/registry/blocks/project-list/ui/minimal/next/project-list.tsx +104 -0
- package/vendor/registry/blocks/project-list/ui/shadcn/next/project-list.tsx +81 -0
- package/vendor/registry/blocks/project-list-cards/module.json +15 -0
- package/vendor/registry/blocks/project-list-cards/ui/minimal/next/project-list-cards.tsx +125 -0
- package/vendor/registry/blocks/project-list-cards/ui/shadcn/next/project-list-cards.tsx +94 -0
- package/vendor/registry/blocks/projects-carousel/module.json +15 -0
- package/vendor/registry/blocks/projects-carousel/ui/minimal/next/projects-carousel-client.tsx +239 -0
- package/vendor/registry/blocks/projects-carousel/ui/minimal/next/projects-carousel.tsx +24 -0
- package/vendor/registry/blocks/projects-carousel/ui/shadcn/next/projects-carousel-client.tsx +102 -0
- package/vendor/registry/blocks/projects-carousel/ui/shadcn/next/projects-carousel.tsx +24 -0
- package/vendor/registry/blocks/service-detail/module.json +15 -0
- package/vendor/registry/blocks/service-detail/ui/minimal/next/service-detail.tsx +49 -0
- package/vendor/registry/blocks/service-detail/ui/shadcn/next/service-detail.tsx +75 -0
- package/vendor/registry/blocks/service-list/module.json +14 -0
- package/vendor/registry/blocks/service-list/ui/minimal/next/service-list.tsx +103 -0
- package/vendor/registry/blocks/service-list/ui/shadcn/next/service-list.tsx +80 -0
- package/vendor/registry/blocks/service-list-cards/module.json +15 -0
- package/vendor/registry/blocks/service-list-cards/ui/minimal/next/service-list-cards.tsx +124 -0
- package/vendor/registry/blocks/service-list-cards/ui/shadcn/next/service-list-cards.tsx +92 -0
- package/vendor/registry/blocks/site-brand/module.json +13 -0
- package/vendor/registry/blocks/site-brand/ui/minimal/next/site-brand.tsx +61 -0
- package/vendor/registry/blocks/site-brand/ui/shadcn/next/site-brand.tsx +48 -0
- package/vendor/registry/blocks/site-logo/module.json +13 -0
- package/vendor/registry/blocks/site-logo/ui/minimal/next/site-logo.tsx +37 -0
- package/vendor/registry/blocks/site-logo/ui/shadcn/next/site-logo.tsx +34 -0
- package/vendor/registry/blocks/social-links/module.json +13 -0
- package/vendor/registry/blocks/social-links/ui/minimal/next/social-links.tsx +55 -0
- package/vendor/registry/blocks/social-links/ui/shadcn/next/social-links.tsx +46 -0
- package/vendor/registry/blocks/team-detail/module.json +15 -0
- package/vendor/registry/blocks/team-detail/ui/minimal/next/team-detail.tsx +113 -0
- package/vendor/registry/blocks/team-detail/ui/shadcn/next/team-detail.tsx +77 -0
- package/vendor/registry/blocks/team-list/module.json +14 -0
- package/vendor/registry/blocks/team-list/ui/minimal/next/team-list.tsx +113 -0
- package/vendor/registry/blocks/team-list/ui/shadcn/next/team-list.tsx +77 -0
- package/vendor/registry/blocks/team-list-cards/module.json +15 -0
- package/vendor/registry/blocks/team-list-cards/ui/minimal/next/team-list-cards.tsx +111 -0
- package/vendor/registry/blocks/team-list-cards/ui/shadcn/next/team-list-cards.tsx +83 -0
- package/vendor/registry/blocks/testimonials-carousel/module.json +15 -0
- package/vendor/registry/blocks/testimonials-carousel/ui/minimal/next/testimonials-carousel-client.tsx +230 -0
- package/vendor/registry/blocks/testimonials-carousel/ui/minimal/next/testimonials-carousel.tsx +23 -0
- package/vendor/registry/blocks/testimonials-carousel/ui/shadcn/next/testimonials-carousel-client.tsx +91 -0
- package/vendor/registry/blocks/testimonials-carousel/ui/shadcn/next/testimonials-carousel.tsx +23 -0
- package/vendor/registry/blocks/testimonials-list/module.json +14 -0
- package/vendor/registry/blocks/testimonials-list/ui/minimal/next/testimonials-list.tsx +109 -0
- package/vendor/registry/blocks/testimonials-list/ui/shadcn/next/testimonials-list.tsx +72 -0
- package/vendor/registry/blocks/testimonials-list-cards/module.json +15 -0
- package/vendor/registry/blocks/testimonials-list-cards/ui/minimal/next/testimonials-list-cards.tsx +114 -0
- package/vendor/registry/blocks/testimonials-list-cards/ui/shadcn/next/testimonials-list-cards.tsx +72 -0
- package/vendor/registry/core/languages/policies.json +25 -0
- package/vendor/registry/core/languages/seed.json +16 -0
- package/vendor/registry/core/languages/snapshot.json +94 -0
- package/vendor/registry/modules/blog/access/policies.json +49 -0
- package/vendor/registry/modules/blog/access/policies.multilocale.json +67 -0
- package/vendor/registry/modules/blog/lib.multilocale.ts +552 -0
- package/vendor/registry/modules/blog/lib.ts +346 -0
- package/vendor/registry/modules/blog/module.json +50 -0
- package/vendor/registry/modules/blog/schema/snapshot.json +701 -0
- package/vendor/registry/modules/blog/schema/snapshot.multilocale.json +884 -0
- package/vendor/registry/modules/blog/services/ATTRIBUTION.md +8 -0
- package/vendor/registry/modules/blog/services/assets/ada-lovelace-avatar.jpg +0 -0
- package/vendor/registry/modules/blog/services/assets/hello-from-dkit-cover.jpg +0 -0
- package/vendor/registry/modules/blog/services/seed.json +70 -0
- package/vendor/registry/modules/blog/services/seed.multilocale.json +90 -0
- package/vendor/registry/modules/blog/types.multilocale.ts +96 -0
- package/vendor/registry/modules/blog/types.ts +62 -0
- package/vendor/registry/modules/booking-form/access/policies.json +25 -0
- package/vendor/registry/modules/booking-form/access/policies.multilocale.json +27 -0
- package/vendor/registry/modules/booking-form/lib.multilocale.ts +71 -0
- package/vendor/registry/modules/booking-form/lib.ts +77 -0
- package/vendor/registry/modules/booking-form/module.json +32 -0
- package/vendor/registry/modules/booking-form/schema/snapshot.json +294 -0
- package/vendor/registry/modules/booking-form/schema/snapshot.multilocale.json +467 -0
- package/vendor/registry/modules/booking-form/services/flows.json +19 -0
- package/vendor/registry/modules/booking-form/types.multilocale.ts +29 -0
- package/vendor/registry/modules/booking-form/types.ts +27 -0
- package/vendor/registry/modules/contact-form/access/policies.json +25 -0
- package/vendor/registry/modules/contact-form/access/policies.multilocale.json +27 -0
- package/vendor/registry/modules/contact-form/lib.multilocale.ts +65 -0
- package/vendor/registry/modules/contact-form/lib.ts +67 -0
- package/vendor/registry/modules/contact-form/module.json +32 -0
- package/vendor/registry/modules/contact-form/schema/snapshot.json +193 -0
- package/vendor/registry/modules/contact-form/schema/snapshot.multilocale.json +293 -0
- package/vendor/registry/modules/contact-form/services/flows.json +19 -0
- package/vendor/registry/modules/contact-form/types.multilocale.ts +21 -0
- package/vendor/registry/modules/contact-form/types.ts +19 -0
- package/vendor/registry/modules/faq/access/policies.json +25 -0
- package/vendor/registry/modules/faq/access/policies.multilocale.json +18 -0
- package/vendor/registry/modules/faq/lib.multilocale.ts +120 -0
- package/vendor/registry/modules/faq/lib.ts +73 -0
- package/vendor/registry/modules/faq/module.json +31 -0
- package/vendor/registry/modules/faq/schema/snapshot.json +180 -0
- package/vendor/registry/modules/faq/schema/snapshot.multilocale.json +116 -0
- package/vendor/registry/modules/faq/services/seed.json +38 -0
- package/vendor/registry/modules/faq/services/seed.multilocale.json +32 -0
- package/vendor/registry/modules/faq/types.multilocale.ts +31 -0
- package/vendor/registry/modules/faq/types.ts +17 -0
- package/vendor/registry/modules/navigation/access/policies.json +31 -0
- package/vendor/registry/modules/navigation/access/policies.multilocale.json +51 -0
- package/vendor/registry/modules/navigation/lib.multilocale.ts +198 -0
- package/vendor/registry/modules/navigation/lib.ts +252 -0
- package/vendor/registry/modules/navigation/module.json +46 -0
- package/vendor/registry/modules/navigation/schema/snapshot.json +453 -0
- package/vendor/registry/modules/navigation/schema/snapshot.multilocale.json +864 -0
- package/vendor/registry/modules/navigation/services/seed.json +103 -0
- package/vendor/registry/modules/navigation/services/seed.multilocale.json +88 -0
- package/vendor/registry/modules/navigation/types.multilocale.ts +60 -0
- package/vendor/registry/modules/navigation/types.ts +44 -0
- package/vendor/registry/modules/pages/access/policies.json +25 -0
- package/vendor/registry/modules/pages/access/policies.multilocale.json +18 -0
- package/vendor/registry/modules/pages/lib.multilocale.ts +166 -0
- package/vendor/registry/modules/pages/lib.ts +123 -0
- package/vendor/registry/modules/pages/module.json +39 -0
- package/vendor/registry/modules/pages/schema/snapshot.json +247 -0
- package/vendor/registry/modules/pages/schema/snapshot.multilocale.json +187 -0
- package/vendor/registry/modules/pages/services/seed.json +24 -0
- package/vendor/registry/modules/pages/services/seed.multilocale.json +34 -0
- package/vendor/registry/modules/pages/types.multilocale.ts +37 -0
- package/vendor/registry/modules/pages/types.ts +21 -0
- package/vendor/registry/modules/projects/access/policies.json +31 -0
- package/vendor/registry/modules/projects/access/policies.multilocale.json +43 -0
- package/vendor/registry/modules/projects/lib.multilocale.ts +111 -0
- package/vendor/registry/modules/projects/lib.ts +138 -0
- package/vendor/registry/modules/projects/module.json +48 -0
- package/vendor/registry/modules/projects/schema/snapshot.json +348 -0
- package/vendor/registry/modules/projects/schema/snapshot.multilocale.json +577 -0
- package/vendor/registry/modules/projects/services/ATTRIBUTION.md +7 -0
- package/vendor/registry/modules/projects/services/assets/brand-identity-cover.jpg +0 -0
- package/vendor/registry/modules/projects/services/seed.json +40 -0
- package/vendor/registry/modules/projects/services/seed.multilocale.json +31 -0
- package/vendor/registry/modules/projects/types.multilocale.ts +38 -0
- package/vendor/registry/modules/projects/types.ts +28 -0
- package/vendor/registry/modules/services/access/policies.json +31 -0
- package/vendor/registry/modules/services/access/policies.multilocale.json +43 -0
- package/vendor/registry/modules/services/lib.multilocale.ts +109 -0
- package/vendor/registry/modules/services/lib.ts +134 -0
- package/vendor/registry/modules/services/module.json +47 -0
- package/vendor/registry/modules/services/schema/snapshot.json +305 -0
- package/vendor/registry/modules/services/schema/snapshot.multilocale.json +510 -0
- package/vendor/registry/modules/services/services/ATTRIBUTION.md +8 -0
- package/vendor/registry/modules/services/services/assets/design-development.jpg +0 -0
- package/vendor/registry/modules/services/services/assets/strategy-consulting.jpg +0 -0
- package/vendor/registry/modules/services/services/seed.json +44 -0
- package/vendor/registry/modules/services/services/seed.multilocale.json +31 -0
- package/vendor/registry/modules/services/types.multilocale.ts +36 -0
- package/vendor/registry/modules/services/types.ts +26 -0
- package/vendor/registry/modules/settings/access/policies.json +31 -0
- package/vendor/registry/modules/settings/access/policies.multilocale.json +43 -0
- package/vendor/registry/modules/settings/lib.multilocale.ts +158 -0
- package/vendor/registry/modules/settings/lib.ts +259 -0
- package/vendor/registry/modules/settings/module.json +33 -0
- package/vendor/registry/modules/settings/schema/snapshot.json +315 -0
- package/vendor/registry/modules/settings/schema/snapshot.multilocale.json +586 -0
- package/vendor/registry/modules/settings/services/assets/dkit-logo.svg +4 -0
- package/vendor/registry/modules/settings/services/seed.json +31 -0
- package/vendor/registry/modules/settings/services/seed.multilocale.json +42 -0
- package/vendor/registry/modules/settings/types.multilocale.ts +72 -0
- package/vendor/registry/modules/settings/types.ts +94 -0
- package/vendor/registry/modules/team/access/policies.json +31 -0
- package/vendor/registry/modules/team/access/policies.multilocale.json +43 -0
- package/vendor/registry/modules/team/lib.multilocale.ts +88 -0
- package/vendor/registry/modules/team/lib.ts +120 -0
- package/vendor/registry/modules/team/module.json +47 -0
- package/vendor/registry/modules/team/schema/snapshot.json +295 -0
- package/vendor/registry/modules/team/schema/snapshot.multilocale.json +525 -0
- package/vendor/registry/modules/team/services/ATTRIBUTION.md +8 -0
- package/vendor/registry/modules/team/services/assets/morgan-lee-photo.jpg +0 -0
- package/vendor/registry/modules/team/services/assets/taylor-kim-photo.jpg +0 -0
- package/vendor/registry/modules/team/services/seed.json +52 -0
- package/vendor/registry/modules/team/services/seed.multilocale.json +30 -0
- package/vendor/registry/modules/team/types.multilocale.ts +33 -0
- package/vendor/registry/modules/team/types.ts +27 -0
- package/vendor/registry/modules/testimonials/access/policies.json +31 -0
- package/vendor/registry/modules/testimonials/access/policies.multilocale.json +43 -0
- package/vendor/registry/modules/testimonials/lib.multilocale.ts +93 -0
- package/vendor/registry/modules/testimonials/lib.ts +85 -0
- package/vendor/registry/modules/testimonials/module.json +41 -0
- package/vendor/registry/modules/testimonials/schema/snapshot.json +248 -0
- package/vendor/registry/modules/testimonials/schema/snapshot.multilocale.json +462 -0
- package/vendor/registry/modules/testimonials/services/ATTRIBUTION.md +8 -0
- package/vendor/registry/modules/testimonials/services/assets/jane-doe-avatar.jpg +0 -0
- package/vendor/registry/modules/testimonials/services/assets/sample-author-avatar.jpg +0 -0
- package/vendor/registry/modules/testimonials/services/seed.json +49 -0
- package/vendor/registry/modules/testimonials/services/seed.multilocale.json +30 -0
- package/vendor/registry/modules/testimonials/types.multilocale.ts +27 -0
- package/vendor/registry/modules/testimonials/types.ts +22 -0
- package/vendor/registry/registry.json +832 -0
- package/vendor/registry/shared/helpers.ts +16 -0
- package/vendor/registry/shared/i18n.ts +74 -0
- package/vendor/registry/shared/minimal.css +83 -0
- package/vendor/registry/shared/paths.ts +50 -0
- package/vendor/registry/shared/prose.css +113 -0
- package/vendor/registry/tsconfig.json +49 -0
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kurbo/dkit",
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Install Directus modules — schema, permissions, flows, and frontend code you own",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"homepage": "https://dkit.run",
|
|
8
|
+
"bin": {
|
|
9
|
+
"dkit": "./dist/bin.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"vendor",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/martijnmichel/dkit.git",
|
|
19
|
+
"directory": "packages/cli"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"directus",
|
|
23
|
+
"cli",
|
|
24
|
+
"schema",
|
|
25
|
+
"components",
|
|
26
|
+
"nextjs",
|
|
27
|
+
"registry"
|
|
28
|
+
],
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "node ./scripts/copy-registry.mjs && tsup && node ./scripts/chmod-bin.mjs",
|
|
34
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
35
|
+
"dev": "tsx watch src/bin.ts",
|
|
36
|
+
"link:global": "pnpm build && pnpm link --global",
|
|
37
|
+
"test": "node --import tsx --test src/**/*.test.ts",
|
|
38
|
+
"lint": "echo 'no lint configured'"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@clack/prompts": "^0.9.1",
|
|
42
|
+
"@directus/sdk": "^18.0.3",
|
|
43
|
+
"commander": "^12.1.0",
|
|
44
|
+
"picocolors": "^1.1.1",
|
|
45
|
+
"zod": "^3.24.1"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@dkit/schema": "workspace:*",
|
|
49
|
+
"@dkit/shared": "workspace:*",
|
|
50
|
+
"@types/node": "^22.10.2",
|
|
51
|
+
"tsup": "^8.3.5",
|
|
52
|
+
"tsx": "^4.19.2",
|
|
53
|
+
"typescript": "^5.7.2"
|
|
54
|
+
},
|
|
55
|
+
"engines": {
|
|
56
|
+
"node": ">=20"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "dkit:block",
|
|
3
|
+
"id": "blog-detail",
|
|
4
|
+
"title": "Blog detail",
|
|
5
|
+
"description": "Article page with categories, byline, and rich text",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"frameworks": [
|
|
8
|
+
"next",
|
|
9
|
+
"nuxt"
|
|
10
|
+
],
|
|
11
|
+
"uiKits": [
|
|
12
|
+
"shadcn",
|
|
13
|
+
"minimal"
|
|
14
|
+
],
|
|
15
|
+
"shadcnComponents": ["badge", "button"],
|
|
16
|
+
"slot": "detail",
|
|
17
|
+
"route": { "kind": "slug" },
|
|
18
|
+
"registryDependencies": [
|
|
19
|
+
"blog"
|
|
20
|
+
],
|
|
21
|
+
"dependencies": [
|
|
22
|
+
"@directus/sdk"
|
|
23
|
+
],
|
|
24
|
+
"layers": [
|
|
25
|
+
"ui"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { getBlogPostBySlug } from "@/lib/dkit/blog";
|
|
2
|
+
|
|
3
|
+
/** Minimal kit — semantic HTML + dkit-prose only. */
|
|
4
|
+
export async function BlogDetail({ slug }: { slug: string }) {
|
|
5
|
+
const post = await getBlogPostBySlug(slug);
|
|
6
|
+
if (!post) return <p>Post not found.</p>;
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<article>
|
|
10
|
+
<h1>{post.title}</h1>
|
|
11
|
+
{post.published_at ? (
|
|
12
|
+
<p>
|
|
13
|
+
<time dateTime={post.published_at}>
|
|
14
|
+
{new Date(post.published_at).toLocaleDateString()}
|
|
15
|
+
</time>
|
|
16
|
+
</p>
|
|
17
|
+
) : null}
|
|
18
|
+
{post.body ? (
|
|
19
|
+
<div
|
|
20
|
+
className="dkit-prose dkit-prose--compact"
|
|
21
|
+
dangerouslySetInnerHTML={{ __html: post.body }}
|
|
22
|
+
/>
|
|
23
|
+
) : null}
|
|
24
|
+
</article>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { featuredImageUrl, getBlogPostBySlug } from '@/lib/dkit/blog'
|
|
3
|
+
|
|
4
|
+
const props = defineProps<{ slug: string }>()
|
|
5
|
+
|
|
6
|
+
const { data: post } = await useAsyncData(`dkit-blog-min-${props.slug}`, () =>
|
|
7
|
+
getBlogPostBySlug(props.slug),
|
|
8
|
+
)
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<p v-if="!post">Post not found.</p>
|
|
13
|
+
<article v-else>
|
|
14
|
+
<img v-if="featuredImageUrl(post)" :src="featuredImageUrl(post)!" alt="" />
|
|
15
|
+
<h1>{{ post.title }}</h1>
|
|
16
|
+
<p v-if="post.published_at">
|
|
17
|
+
<time :datetime="post.published_at">
|
|
18
|
+
{{ new Date(post.published_at).toLocaleDateString() }}
|
|
19
|
+
</time>
|
|
20
|
+
</p>
|
|
21
|
+
<div
|
|
22
|
+
v-if="post.body"
|
|
23
|
+
class="dkit-prose dkit-prose--compact"
|
|
24
|
+
v-html="post.body"
|
|
25
|
+
/>
|
|
26
|
+
</article>
|
|
27
|
+
</template>
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import {
|
|
2
|
+
authorAvatarUrl,
|
|
3
|
+
authorName,
|
|
4
|
+
featuredImageUrl,
|
|
5
|
+
getBlogPostBySlug,
|
|
6
|
+
normalizeCategories,
|
|
7
|
+
} from "@/lib/dkit/blog";
|
|
8
|
+
import { moduleHref } from "@/lib/dkit/paths";
|
|
9
|
+
import { Badge } from "@/components/ui/badge";
|
|
10
|
+
import { buttonVariants } from "@/components/ui/button";
|
|
11
|
+
import { cn } from "@/lib/utils";
|
|
12
|
+
|
|
13
|
+
/** Uses your project's shadcn/ui components. */
|
|
14
|
+
export async function BlogDetail({
|
|
15
|
+
slug,
|
|
16
|
+
}: {
|
|
17
|
+
slug: string;
|
|
18
|
+
}) {
|
|
19
|
+
const basePath = await moduleHref("blog");
|
|
20
|
+
const post = await getBlogPostBySlug(slug);
|
|
21
|
+
if (!post) {
|
|
22
|
+
return (
|
|
23
|
+
<div className="mx-auto max-w-2xl px-6 py-20 text-center text-muted-foreground">
|
|
24
|
+
<p className="text-2xl font-semibold text-foreground">Post not found</p>
|
|
25
|
+
<a
|
|
26
|
+
href={basePath}
|
|
27
|
+
className={cn(buttonVariants({ variant: "link" }), "mt-4")}
|
|
28
|
+
>
|
|
29
|
+
← Back to blog
|
|
30
|
+
</a>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const name = authorName(post);
|
|
36
|
+
const avatar = authorAvatarUrl(post);
|
|
37
|
+
const categories = normalizeCategories(post.categories);
|
|
38
|
+
const imageUrl = featuredImageUrl(post);
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<article className="mx-auto max-w-2xl px-6 py-16 sm:py-20">
|
|
42
|
+
<a
|
|
43
|
+
href={basePath}
|
|
44
|
+
className={cn(buttonVariants({ variant: "ghost" }), "mb-10")}
|
|
45
|
+
>
|
|
46
|
+
← All posts
|
|
47
|
+
</a>
|
|
48
|
+
|
|
49
|
+
{imageUrl ? (
|
|
50
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
51
|
+
<img
|
|
52
|
+
src={imageUrl}
|
|
53
|
+
alt=""
|
|
54
|
+
className="mb-10 aspect-[16/9] w-full rounded-xl object-cover ring-1 ring-border"
|
|
55
|
+
/>
|
|
56
|
+
) : null}
|
|
57
|
+
|
|
58
|
+
<header className="border-b border-border pb-10">
|
|
59
|
+
{categories.length > 0 ? (
|
|
60
|
+
<div className="mb-4 flex flex-wrap gap-2">
|
|
61
|
+
{categories.map((c) => (
|
|
62
|
+
<Badge key={c.id} variant="secondary">
|
|
63
|
+
{c.title ?? c.slug}
|
|
64
|
+
</Badge>
|
|
65
|
+
))}
|
|
66
|
+
</div>
|
|
67
|
+
) : null}
|
|
68
|
+
<h1 className="text-4xl font-semibold leading-[1.15] tracking-tight text-foreground sm:text-5xl">
|
|
69
|
+
{post.title}
|
|
70
|
+
</h1>
|
|
71
|
+
<div className="mt-6 flex flex-wrap items-center gap-x-3 gap-y-1 text-sm text-muted-foreground">
|
|
72
|
+
{name ? (
|
|
73
|
+
<span className="inline-flex items-center gap-2 font-medium text-foreground">
|
|
74
|
+
{avatar ? (
|
|
75
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
76
|
+
<img
|
|
77
|
+
src={avatar}
|
|
78
|
+
alt=""
|
|
79
|
+
className="h-7 w-7 rounded-full object-cover ring-1 ring-border"
|
|
80
|
+
/>
|
|
81
|
+
) : null}
|
|
82
|
+
{name}
|
|
83
|
+
</span>
|
|
84
|
+
) : null}
|
|
85
|
+
{name && post.published_at ? <span aria-hidden>·</span> : null}
|
|
86
|
+
{post.published_at ? (
|
|
87
|
+
<time dateTime={post.published_at}>
|
|
88
|
+
{new Date(post.published_at).toLocaleDateString(undefined, {
|
|
89
|
+
year: "numeric",
|
|
90
|
+
month: "long",
|
|
91
|
+
day: "numeric",
|
|
92
|
+
})}
|
|
93
|
+
</time>
|
|
94
|
+
) : null}
|
|
95
|
+
</div>
|
|
96
|
+
</header>
|
|
97
|
+
|
|
98
|
+
{post.body ? (
|
|
99
|
+
<div
|
|
100
|
+
className="dkit-prose mt-10"
|
|
101
|
+
dangerouslySetInnerHTML={{ __html: post.body }}
|
|
102
|
+
/>
|
|
103
|
+
) : null}
|
|
104
|
+
</article>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
authorAvatarUrl,
|
|
4
|
+
authorName,
|
|
5
|
+
featuredImageUrl,
|
|
6
|
+
getBlogPostBySlug,
|
|
7
|
+
normalizeCategories,
|
|
8
|
+
} from '@/lib/dkit/blog'
|
|
9
|
+
import { moduleBasePath } from '@/lib/dkit/config'
|
|
10
|
+
import { Badge } from '@/components/ui/badge'
|
|
11
|
+
import { Button } from '@/components/ui/button'
|
|
12
|
+
|
|
13
|
+
/** Uses your project's shadcn-vue components. */
|
|
14
|
+
const props = withDefaults(defineProps<{ slug: string; basePath?: string }>(), {
|
|
15
|
+
basePath: undefined,
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
const resolvedBase = computed(
|
|
19
|
+
() => props.basePath ?? moduleBasePath('blog', '/blog'),
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
const { data: post } = await useAsyncData(`dkit-blog-${props.slug}`, () =>
|
|
23
|
+
getBlogPostBySlug(props.slug),
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
const categories = computed(() =>
|
|
27
|
+
post.value ? normalizeCategories(post.value.categories) : [],
|
|
28
|
+
)
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<template>
|
|
32
|
+
<div
|
|
33
|
+
v-if="!post"
|
|
34
|
+
class="mx-auto max-w-2xl px-6 py-20 text-center text-muted-foreground"
|
|
35
|
+
>
|
|
36
|
+
<p class="text-2xl font-semibold text-foreground">Post not found</p>
|
|
37
|
+
<Button
|
|
38
|
+
as-child
|
|
39
|
+
variant="link"
|
|
40
|
+
class="mt-4"
|
|
41
|
+
>
|
|
42
|
+
<NuxtLink :to="resolvedBase">← Back to blog</NuxtLink>
|
|
43
|
+
</Button>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<article
|
|
47
|
+
v-else
|
|
48
|
+
class="mx-auto max-w-2xl px-6 py-16 sm:py-20"
|
|
49
|
+
>
|
|
50
|
+
<Button
|
|
51
|
+
as-child
|
|
52
|
+
variant="ghost"
|
|
53
|
+
class="mb-10 px-0"
|
|
54
|
+
>
|
|
55
|
+
<NuxtLink :to="resolvedBase">← All posts</NuxtLink>
|
|
56
|
+
</Button>
|
|
57
|
+
|
|
58
|
+
<img
|
|
59
|
+
v-if="featuredImageUrl(post)"
|
|
60
|
+
:src="featuredImageUrl(post)!"
|
|
61
|
+
alt=""
|
|
62
|
+
class="mb-10 aspect-[16/9] w-full rounded-xl object-cover ring-1 ring-border"
|
|
63
|
+
/>
|
|
64
|
+
|
|
65
|
+
<header class="border-b border-border pb-10">
|
|
66
|
+
<div
|
|
67
|
+
v-if="categories.length"
|
|
68
|
+
class="mb-4 flex flex-wrap gap-2"
|
|
69
|
+
>
|
|
70
|
+
<Badge
|
|
71
|
+
v-for="c in categories"
|
|
72
|
+
:key="c.id"
|
|
73
|
+
variant="secondary"
|
|
74
|
+
>
|
|
75
|
+
{{ c.title ?? c.slug }}
|
|
76
|
+
</Badge>
|
|
77
|
+
</div>
|
|
78
|
+
<h1 class="text-4xl font-semibold leading-[1.15] tracking-tight text-foreground sm:text-5xl">
|
|
79
|
+
{{ post.title }}
|
|
80
|
+
</h1>
|
|
81
|
+
<div class="mt-6 flex flex-wrap items-center gap-x-3 gap-y-1 text-sm text-muted-foreground">
|
|
82
|
+
<span
|
|
83
|
+
v-if="authorName(post)"
|
|
84
|
+
class="inline-flex items-center gap-2 font-medium text-foreground"
|
|
85
|
+
>
|
|
86
|
+
<img
|
|
87
|
+
v-if="authorAvatarUrl(post)"
|
|
88
|
+
:src="authorAvatarUrl(post)!"
|
|
89
|
+
alt=""
|
|
90
|
+
class="h-7 w-7 rounded-full object-cover ring-1 ring-border"
|
|
91
|
+
/>
|
|
92
|
+
{{ authorName(post) }}
|
|
93
|
+
</span>
|
|
94
|
+
<span v-if="authorName(post) && post.published_at" aria-hidden>·</span>
|
|
95
|
+
<time
|
|
96
|
+
v-if="post.published_at"
|
|
97
|
+
:datetime="post.published_at"
|
|
98
|
+
>
|
|
99
|
+
{{
|
|
100
|
+
new Date(post.published_at).toLocaleDateString(undefined, {
|
|
101
|
+
year: 'numeric',
|
|
102
|
+
month: 'long',
|
|
103
|
+
day: 'numeric',
|
|
104
|
+
})
|
|
105
|
+
}}
|
|
106
|
+
</time>
|
|
107
|
+
</div>
|
|
108
|
+
</header>
|
|
109
|
+
|
|
110
|
+
<div
|
|
111
|
+
v-if="post.body"
|
|
112
|
+
class="dkit-prose mt-10"
|
|
113
|
+
v-html="post.body"
|
|
114
|
+
/>
|
|
115
|
+
</article>
|
|
116
|
+
</template>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "dkit:block",
|
|
3
|
+
"id": "blog-list",
|
|
4
|
+
"title": "Blog list",
|
|
5
|
+
"description": "Stacked post list with optional thumbnails",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"frameworks": [
|
|
8
|
+
"next",
|
|
9
|
+
"nuxt"
|
|
10
|
+
],
|
|
11
|
+
"uiKits": [
|
|
12
|
+
"shadcn",
|
|
13
|
+
"minimal"
|
|
14
|
+
],
|
|
15
|
+
"slot": "list",
|
|
16
|
+
"route": { "kind": "index" },
|
|
17
|
+
"registryDependencies": [
|
|
18
|
+
"blog"
|
|
19
|
+
],
|
|
20
|
+
"dependencies": [
|
|
21
|
+
"@directus/sdk"
|
|
22
|
+
],
|
|
23
|
+
"layers": [
|
|
24
|
+
"ui"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import {
|
|
2
|
+
authorAvatarUrl,
|
|
3
|
+
authorName,
|
|
4
|
+
featuredImageUrl,
|
|
5
|
+
getBlogPosts,
|
|
6
|
+
} from "@/lib/dkit/blog";
|
|
7
|
+
import { moduleHref } from "@/lib/dkit/paths";
|
|
8
|
+
|
|
9
|
+
/** Minimal kit — semantic HTML + small inlined layout CSS (no Tailwind). */
|
|
10
|
+
export async function BlogList() {
|
|
11
|
+
const posts = await getBlogPosts();
|
|
12
|
+
const hrefById = Object.fromEntries(
|
|
13
|
+
await Promise.all(
|
|
14
|
+
posts.map(async (post) => [post.id, await moduleHref("blog", post.slug)] as const),
|
|
15
|
+
),
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<section>
|
|
20
|
+
<style>{`
|
|
21
|
+
.dkit-blog-list {
|
|
22
|
+
list-style: none;
|
|
23
|
+
margin: 0;
|
|
24
|
+
padding: 0;
|
|
25
|
+
}
|
|
26
|
+
.dkit-blog-list > li {
|
|
27
|
+
display: flex;
|
|
28
|
+
gap: 1rem;
|
|
29
|
+
padding: 1rem 0;
|
|
30
|
+
border-bottom: 1px solid #ddd;
|
|
31
|
+
}
|
|
32
|
+
.dkit-blog-list > li:last-child {
|
|
33
|
+
border-bottom: 0;
|
|
34
|
+
}
|
|
35
|
+
.dkit-blog-list__thumb {
|
|
36
|
+
flex: 0 0 auto;
|
|
37
|
+
width: 7.5rem;
|
|
38
|
+
height: 7.5rem;
|
|
39
|
+
object-fit: cover;
|
|
40
|
+
}
|
|
41
|
+
.dkit-blog-list__body {
|
|
42
|
+
min-width: 0;
|
|
43
|
+
flex: 1;
|
|
44
|
+
}
|
|
45
|
+
.dkit-blog-list__title {
|
|
46
|
+
margin: 0 0 0.25rem;
|
|
47
|
+
font-size: 1.25rem;
|
|
48
|
+
}
|
|
49
|
+
.dkit-blog-list__meta {
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-wrap: wrap;
|
|
52
|
+
align-items: center;
|
|
53
|
+
gap: 0.5rem;
|
|
54
|
+
margin: 0.5rem 0 0;
|
|
55
|
+
font-size: 0.875rem;
|
|
56
|
+
}
|
|
57
|
+
.dkit-blog-list__avatar {
|
|
58
|
+
width: 1.25rem;
|
|
59
|
+
height: 1.25rem;
|
|
60
|
+
border-radius: 9999px;
|
|
61
|
+
object-fit: cover;
|
|
62
|
+
vertical-align: middle;
|
|
63
|
+
}
|
|
64
|
+
.dkit-blog-list__excerpt {
|
|
65
|
+
margin: 0.5rem 0 0;
|
|
66
|
+
}
|
|
67
|
+
`}</style>
|
|
68
|
+
|
|
69
|
+
<header>
|
|
70
|
+
<h1>Blog</h1>
|
|
71
|
+
</header>
|
|
72
|
+
|
|
73
|
+
{posts.length === 0 ? (
|
|
74
|
+
<p>No published posts yet.</p>
|
|
75
|
+
) : (
|
|
76
|
+
<ul className="dkit-blog-list">
|
|
77
|
+
{posts.map((post) => {
|
|
78
|
+
const imageUrl = featuredImageUrl(post);
|
|
79
|
+
const name = authorName(post);
|
|
80
|
+
const avatar = authorAvatarUrl(post);
|
|
81
|
+
return (
|
|
82
|
+
<li key={post.id}>
|
|
83
|
+
{imageUrl ? (
|
|
84
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
85
|
+
<img
|
|
86
|
+
className="dkit-blog-list__thumb"
|
|
87
|
+
src={imageUrl}
|
|
88
|
+
alt=""
|
|
89
|
+
width={120}
|
|
90
|
+
height={120}
|
|
91
|
+
/>
|
|
92
|
+
) : null}
|
|
93
|
+
<div className="dkit-blog-list__body">
|
|
94
|
+
<h2 className="dkit-blog-list__title">
|
|
95
|
+
<a href={hrefById[post.id]!}>
|
|
96
|
+
{post.title}
|
|
97
|
+
</a>
|
|
98
|
+
</h2>
|
|
99
|
+
{post.published_at ? (
|
|
100
|
+
<time dateTime={post.published_at}>
|
|
101
|
+
{new Date(post.published_at).toLocaleDateString()}
|
|
102
|
+
</time>
|
|
103
|
+
) : null}
|
|
104
|
+
{name ? (
|
|
105
|
+
<p className="dkit-blog-list__meta">
|
|
106
|
+
{avatar ? (
|
|
107
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
108
|
+
<img
|
|
109
|
+
className="dkit-blog-list__avatar"
|
|
110
|
+
src={avatar}
|
|
111
|
+
alt=""
|
|
112
|
+
width={20}
|
|
113
|
+
height={20}
|
|
114
|
+
/>
|
|
115
|
+
) : null}
|
|
116
|
+
<span>{name}</span>
|
|
117
|
+
</p>
|
|
118
|
+
) : null}
|
|
119
|
+
{post.excerpt ? (
|
|
120
|
+
<p className="dkit-blog-list__excerpt">{post.excerpt}</p>
|
|
121
|
+
) : null}
|
|
122
|
+
</div>
|
|
123
|
+
</li>
|
|
124
|
+
);
|
|
125
|
+
})}
|
|
126
|
+
</ul>
|
|
127
|
+
)}
|
|
128
|
+
</section>
|
|
129
|
+
);
|
|
130
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
authorAvatarUrl,
|
|
4
|
+
authorName,
|
|
5
|
+
featuredImageUrl,
|
|
6
|
+
getBlogPosts,
|
|
7
|
+
} from '@/lib/dkit/blog'
|
|
8
|
+
import { joinModulePath, moduleBasePath } from '@/lib/dkit/config'
|
|
9
|
+
|
|
10
|
+
/** Minimal kit — semantic HTML only (browser-default controls / images). */
|
|
11
|
+
const props = withDefaults(defineProps<{ basePath?: string }>(), {
|
|
12
|
+
basePath: undefined,
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
const resolvedBase = computed(
|
|
16
|
+
() => props.basePath ?? moduleBasePath('blog', '/blog'),
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
const { data: posts } = await useAsyncData('dkit-blog-list-min', () => getBlogPosts())
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<section>
|
|
24
|
+
<header>
|
|
25
|
+
<h1>Blog</h1>
|
|
26
|
+
</header>
|
|
27
|
+
|
|
28
|
+
<p v-if="!(posts && posts.length)">No published posts yet.</p>
|
|
29
|
+
|
|
30
|
+
<ul v-else>
|
|
31
|
+
<li v-for="post in posts" :key="post.id">
|
|
32
|
+
<img
|
|
33
|
+
v-if="featuredImageUrl(post)"
|
|
34
|
+
:src="featuredImageUrl(post)!"
|
|
35
|
+
alt=""
|
|
36
|
+
width="120"
|
|
37
|
+
height="120"
|
|
38
|
+
/>
|
|
39
|
+
<NuxtLink :to="joinModulePath(resolvedBase, post.slug)">
|
|
40
|
+
{{ post.title }}
|
|
41
|
+
</NuxtLink>
|
|
42
|
+
<template v-if="post.published_at">
|
|
43
|
+
{{ ' ' }}
|
|
44
|
+
<time :datetime="post.published_at">
|
|
45
|
+
{{ new Date(post.published_at).toLocaleDateString() }}
|
|
46
|
+
</time>
|
|
47
|
+
</template>
|
|
48
|
+
<p v-if="authorName(post)">
|
|
49
|
+
<img
|
|
50
|
+
v-if="authorAvatarUrl(post)"
|
|
51
|
+
:src="authorAvatarUrl(post)!"
|
|
52
|
+
alt=""
|
|
53
|
+
width="24"
|
|
54
|
+
height="24"
|
|
55
|
+
/>
|
|
56
|
+
{{ authorName(post) }}
|
|
57
|
+
</p>
|
|
58
|
+
<p v-if="post.excerpt">{{ post.excerpt }}</p>
|
|
59
|
+
</li>
|
|
60
|
+
</ul>
|
|
61
|
+
</section>
|
|
62
|
+
</template>
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import {
|
|
2
|
+
authorAvatarUrl,
|
|
3
|
+
authorName,
|
|
4
|
+
featuredImageUrl,
|
|
5
|
+
getBlogPosts,
|
|
6
|
+
} from "@/lib/dkit/blog";
|
|
7
|
+
import { moduleHref } from "@/lib/dkit/paths";
|
|
8
|
+
|
|
9
|
+
/** Styled with shadcn theme tokens — inherits your app theme (Next shadcn/ui). */
|
|
10
|
+
export async function BlogList() {
|
|
11
|
+
const posts = await getBlogPosts();
|
|
12
|
+
const hrefById = Object.fromEntries(
|
|
13
|
+
await Promise.all(
|
|
14
|
+
posts.map(async (post) => [post.id, await moduleHref("blog", post.slug)] as const),
|
|
15
|
+
),
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<div className="relative mx-auto max-w-2xl px-6 py-16 sm:py-20">
|
|
20
|
+
<header className="mb-12 border-b border-border pb-10">
|
|
21
|
+
<p className="mb-3 text-xs font-medium tracking-[0.2em] text-primary uppercase">
|
|
22
|
+
Journal
|
|
23
|
+
</p>
|
|
24
|
+
<h1 className="text-4xl font-semibold leading-tight tracking-tight text-foreground sm:text-5xl">
|
|
25
|
+
Blog
|
|
26
|
+
</h1>
|
|
27
|
+
<p className="mt-4 max-w-md text-base leading-relaxed text-muted-foreground">
|
|
28
|
+
Newest posts first.
|
|
29
|
+
</p>
|
|
30
|
+
</header>
|
|
31
|
+
|
|
32
|
+
{posts.length === 0 ? (
|
|
33
|
+
<p className="rounded-xl border border-dashed border-border bg-muted/40 px-6 py-10 text-center text-muted-foreground">
|
|
34
|
+
No published posts yet.
|
|
35
|
+
</p>
|
|
36
|
+
) : (
|
|
37
|
+
<ul className="space-y-1">
|
|
38
|
+
{posts.map((post, i) => {
|
|
39
|
+
const imageUrl = featuredImageUrl(post);
|
|
40
|
+
const avatar = authorAvatarUrl(post);
|
|
41
|
+
const name = authorName(post);
|
|
42
|
+
return (
|
|
43
|
+
<li key={post.id}>
|
|
44
|
+
<a
|
|
45
|
+
href={hrefById[post.id]!}
|
|
46
|
+
className="group flex gap-5 rounded-xl px-4 py-5 transition-colors hover:bg-muted/60"
|
|
47
|
+
>
|
|
48
|
+
{imageUrl ? (
|
|
49
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
50
|
+
<img
|
|
51
|
+
src={imageUrl}
|
|
52
|
+
alt=""
|
|
53
|
+
className="mt-0.5 h-16 w-16 shrink-0 rounded-lg object-cover ring-1 ring-border"
|
|
54
|
+
/>
|
|
55
|
+
) : (
|
|
56
|
+
<span className="mt-1 w-8 shrink-0 font-mono text-xs text-muted-foreground tabular-nums">
|
|
57
|
+
{String(i + 1).padStart(2, "0")}
|
|
58
|
+
</span>
|
|
59
|
+
)}
|
|
60
|
+
<span className="min-w-0 flex-1">
|
|
61
|
+
<span className="block text-xl font-medium tracking-tight text-foreground transition-colors group-hover:text-primary">
|
|
62
|
+
{post.title}
|
|
63
|
+
</span>
|
|
64
|
+
{post.excerpt ? (
|
|
65
|
+
<span className="mt-2 block text-sm leading-relaxed text-muted-foreground">
|
|
66
|
+
{post.excerpt}
|
|
67
|
+
</span>
|
|
68
|
+
) : null}
|
|
69
|
+
<span className="mt-3 flex flex-wrap items-center gap-x-2 text-xs text-muted-foreground">
|
|
70
|
+
{name ? (
|
|
71
|
+
<span className="inline-flex items-center gap-1.5">
|
|
72
|
+
{avatar ? (
|
|
73
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
74
|
+
<img
|
|
75
|
+
src={avatar}
|
|
76
|
+
alt=""
|
|
77
|
+
className="h-5 w-5 rounded-full object-cover ring-1 ring-border"
|
|
78
|
+
/>
|
|
79
|
+
) : null}
|
|
80
|
+
<span>{name}</span>
|
|
81
|
+
</span>
|
|
82
|
+
) : null}
|
|
83
|
+
{name && post.published_at ? <span aria-hidden>·</span> : null}
|
|
84
|
+
{post.published_at ? (
|
|
85
|
+
<time dateTime={post.published_at}>
|
|
86
|
+
{new Date(post.published_at).toLocaleDateString(
|
|
87
|
+
undefined,
|
|
88
|
+
{
|
|
89
|
+
year: "numeric",
|
|
90
|
+
month: "short",
|
|
91
|
+
day: "numeric",
|
|
92
|
+
},
|
|
93
|
+
)}
|
|
94
|
+
</time>
|
|
95
|
+
) : null}
|
|
96
|
+
<span className="ml-auto text-primary opacity-0 transition group-hover:opacity-100">
|
|
97
|
+
Read →
|
|
98
|
+
</span>
|
|
99
|
+
</span>
|
|
100
|
+
</span>
|
|
101
|
+
</a>
|
|
102
|
+
</li>
|
|
103
|
+
);
|
|
104
|
+
})}
|
|
105
|
+
</ul>
|
|
106
|
+
)}
|
|
107
|
+
</div>
|
|
108
|
+
);
|
|
109
|
+
}
|