@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
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useId, useRef, useState } from "react";
|
|
4
|
+
import { MenuIcon, XIcon } from "lucide-react";
|
|
5
|
+
import { Button } from "@/components/ui/button";
|
|
6
|
+
import {
|
|
7
|
+
NavigationMenu,
|
|
8
|
+
NavigationMenuContent,
|
|
9
|
+
NavigationMenuItem,
|
|
10
|
+
NavigationMenuLink,
|
|
11
|
+
NavigationMenuList,
|
|
12
|
+
NavigationMenuTrigger,
|
|
13
|
+
} from "@/components/ui/navigation-menu";
|
|
14
|
+
import { navLinkProps, type NavItem } from "@/lib/dkit/navigation";
|
|
15
|
+
|
|
16
|
+
function NavAnchor({
|
|
17
|
+
item,
|
|
18
|
+
className,
|
|
19
|
+
onNavigate,
|
|
20
|
+
}: {
|
|
21
|
+
item: NavItem;
|
|
22
|
+
className?: string;
|
|
23
|
+
onNavigate?: () => void;
|
|
24
|
+
}) {
|
|
25
|
+
const props = navLinkProps(item);
|
|
26
|
+
return (
|
|
27
|
+
<a
|
|
28
|
+
{...props}
|
|
29
|
+
className={className}
|
|
30
|
+
onClick={() => {
|
|
31
|
+
onNavigate?.();
|
|
32
|
+
}}
|
|
33
|
+
>
|
|
34
|
+
{item.label}
|
|
35
|
+
</a>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function DesktopItem({ item }: { item: NavItem }) {
|
|
40
|
+
const children = item.children?.filter(Boolean) ?? [];
|
|
41
|
+
if (children.length === 0) {
|
|
42
|
+
return (
|
|
43
|
+
<NavigationMenuItem>
|
|
44
|
+
<NavigationMenuLink
|
|
45
|
+
href={item.href}
|
|
46
|
+
{...(item.open_in_new_tab
|
|
47
|
+
? { target: "_blank", rel: "noopener noreferrer" }
|
|
48
|
+
: {})}
|
|
49
|
+
className="inline-flex h-9 items-center rounded-md px-4 py-2 text-sm font-medium text-foreground hover:bg-accent"
|
|
50
|
+
>
|
|
51
|
+
{item.label}
|
|
52
|
+
</NavigationMenuLink>
|
|
53
|
+
</NavigationMenuItem>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
return (
|
|
57
|
+
<NavigationMenuItem>
|
|
58
|
+
<NavigationMenuTrigger>{item.label}</NavigationMenuTrigger>
|
|
59
|
+
<NavigationMenuContent>
|
|
60
|
+
<ul className="grid min-w-48 gap-1 p-1">
|
|
61
|
+
{children.map((child) => {
|
|
62
|
+
const link = navLinkProps(child);
|
|
63
|
+
return (
|
|
64
|
+
<li key={child.id}>
|
|
65
|
+
<NavigationMenuLink
|
|
66
|
+
href={link.href}
|
|
67
|
+
target={link.target}
|
|
68
|
+
rel={link.rel}
|
|
69
|
+
className="block rounded-md px-3 py-2 text-sm hover:bg-accent"
|
|
70
|
+
>
|
|
71
|
+
{child.label}
|
|
72
|
+
</NavigationMenuLink>
|
|
73
|
+
</li>
|
|
74
|
+
);
|
|
75
|
+
})}
|
|
76
|
+
</ul>
|
|
77
|
+
</NavigationMenuContent>
|
|
78
|
+
</NavigationMenuItem>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function MobileTree({
|
|
83
|
+
items,
|
|
84
|
+
onNavigate,
|
|
85
|
+
}: {
|
|
86
|
+
items: NavItem[];
|
|
87
|
+
onNavigate: () => void;
|
|
88
|
+
}) {
|
|
89
|
+
return (
|
|
90
|
+
<ul className="flex flex-col gap-0.5">
|
|
91
|
+
{items.map((item) => {
|
|
92
|
+
const children = item.children?.filter(Boolean) ?? [];
|
|
93
|
+
return (
|
|
94
|
+
<li key={item.id}>
|
|
95
|
+
<NavAnchor
|
|
96
|
+
item={item}
|
|
97
|
+
onNavigate={onNavigate}
|
|
98
|
+
className="block rounded-md px-2.5 py-2 text-sm font-medium hover:bg-accent"
|
|
99
|
+
/>
|
|
100
|
+
{children.length > 0 ? (
|
|
101
|
+
<ul className="ml-2 border-l border-border pl-2">
|
|
102
|
+
{children.map((child) => (
|
|
103
|
+
<li key={child.id}>
|
|
104
|
+
<NavAnchor
|
|
105
|
+
item={child}
|
|
106
|
+
onNavigate={onNavigate}
|
|
107
|
+
className="block rounded-md px-2.5 py-1.5 text-sm text-muted-foreground hover:bg-accent hover:text-foreground"
|
|
108
|
+
/>
|
|
109
|
+
</li>
|
|
110
|
+
))}
|
|
111
|
+
</ul>
|
|
112
|
+
) : null}
|
|
113
|
+
</li>
|
|
114
|
+
);
|
|
115
|
+
})}
|
|
116
|
+
</ul>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** Menu controls only — wrap with your own header chrome + SiteBrand. */
|
|
121
|
+
export function NavHeaderClient({ items }: { items: NavItem[] }) {
|
|
122
|
+
const [open, setOpen] = useState(false);
|
|
123
|
+
const rootRef = useRef<HTMLElement>(null);
|
|
124
|
+
const panelId = useId();
|
|
125
|
+
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
if (!open) return;
|
|
128
|
+
const onPointer = (event: PointerEvent) => {
|
|
129
|
+
if (!rootRef.current?.contains(event.target as Node)) setOpen(false);
|
|
130
|
+
};
|
|
131
|
+
const onKey = (event: KeyboardEvent) => {
|
|
132
|
+
if (event.key === "Escape") setOpen(false);
|
|
133
|
+
};
|
|
134
|
+
document.addEventListener("pointerdown", onPointer);
|
|
135
|
+
document.addEventListener("keydown", onKey);
|
|
136
|
+
return () => {
|
|
137
|
+
document.removeEventListener("pointerdown", onPointer);
|
|
138
|
+
document.removeEventListener("keydown", onKey);
|
|
139
|
+
};
|
|
140
|
+
}, [open]);
|
|
141
|
+
|
|
142
|
+
return (
|
|
143
|
+
<nav
|
|
144
|
+
ref={rootRef}
|
|
145
|
+
aria-label="Primary"
|
|
146
|
+
className="flex w-full items-center justify-end gap-4"
|
|
147
|
+
>
|
|
148
|
+
<NavigationMenu className="hidden md:flex">
|
|
149
|
+
<NavigationMenuList>
|
|
150
|
+
{items.map((item) => (
|
|
151
|
+
<DesktopItem key={item.id} item={item} />
|
|
152
|
+
))}
|
|
153
|
+
</NavigationMenuList>
|
|
154
|
+
</NavigationMenu>
|
|
155
|
+
|
|
156
|
+
<Button
|
|
157
|
+
type="button"
|
|
158
|
+
variant="outline"
|
|
159
|
+
size="icon"
|
|
160
|
+
className="md:hidden"
|
|
161
|
+
aria-label={open ? "Close menu" : "Open menu"}
|
|
162
|
+
aria-expanded={open}
|
|
163
|
+
aria-controls={panelId}
|
|
164
|
+
onClick={() => setOpen((value) => !value)}
|
|
165
|
+
>
|
|
166
|
+
{open ? (
|
|
167
|
+
<XIcon className="size-4" />
|
|
168
|
+
) : (
|
|
169
|
+
<MenuIcon className="size-4" />
|
|
170
|
+
)}
|
|
171
|
+
</Button>
|
|
172
|
+
|
|
173
|
+
{open ? (
|
|
174
|
+
<div
|
|
175
|
+
id={panelId}
|
|
176
|
+
className="absolute inset-x-0 top-full z-50 border-b bg-popover text-popover-foreground shadow-md md:hidden"
|
|
177
|
+
>
|
|
178
|
+
<div className="px-4 py-3 sm:px-6">
|
|
179
|
+
<MobileTree items={items} onNavigate={() => setOpen(false)} />
|
|
180
|
+
</div>
|
|
181
|
+
</div>
|
|
182
|
+
) : null}
|
|
183
|
+
</nav>
|
|
184
|
+
);
|
|
185
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getNavMenuByKey,
|
|
3
|
+
type NavItem,
|
|
4
|
+
} from "@/lib/dkit/navigation";
|
|
5
|
+
import { NavHeaderClient } from "./nav-header-client";
|
|
6
|
+
|
|
7
|
+
/** Primary nav only — compose with SiteBrand / SocialLinks yourself. */
|
|
8
|
+
export async function NavHeader({ menuKey = "primary" }: { menuKey?: string }) {
|
|
9
|
+
const menu = await getNavMenuByKey(menuKey);
|
|
10
|
+
const items: NavItem[] = menu?.items ?? [];
|
|
11
|
+
return <NavHeaderClient items={items} />;
|
|
12
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "dkit:block",
|
|
3
|
+
"id": "page-detail",
|
|
4
|
+
"title": "Page detail",
|
|
5
|
+
"description": "WYSIWYG page view with title, excerpt, and body",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"frameworks": [
|
|
8
|
+
"next",
|
|
9
|
+
"nuxt"
|
|
10
|
+
],
|
|
11
|
+
"uiKits": [
|
|
12
|
+
"shadcn",
|
|
13
|
+
"minimal"
|
|
14
|
+
],
|
|
15
|
+
"slot": "detail",
|
|
16
|
+
"route": { "kind": "slug" },
|
|
17
|
+
"registryDependencies": [
|
|
18
|
+
"pages"
|
|
19
|
+
],
|
|
20
|
+
"dependencies": [
|
|
21
|
+
"@directus/sdk"
|
|
22
|
+
],
|
|
23
|
+
"layers": [
|
|
24
|
+
"ui"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { getPageBySlug } from "@/lib/dkit/pages";
|
|
2
|
+
|
|
3
|
+
/** Minimal kit — semantic HTML + dkit-prose only. */
|
|
4
|
+
export async function PageDetail({ slug }: { slug: string }) {
|
|
5
|
+
const page = await getPageBySlug(slug);
|
|
6
|
+
if (!page) return <p>Page not found.</p>;
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<article>
|
|
10
|
+
<h1>{page.title}</h1>
|
|
11
|
+
{page.published_at ? (
|
|
12
|
+
<p>
|
|
13
|
+
<time dateTime={page.published_at}>
|
|
14
|
+
{new Date(page.published_at).toLocaleDateString()}
|
|
15
|
+
</time>
|
|
16
|
+
</p>
|
|
17
|
+
) : null}
|
|
18
|
+
{page.body ? (
|
|
19
|
+
<div
|
|
20
|
+
className="dkit-prose dkit-prose--compact"
|
|
21
|
+
dangerouslySetInnerHTML={{ __html: page.body }}
|
|
22
|
+
/>
|
|
23
|
+
) : null}
|
|
24
|
+
</article>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { getPageBySlug } from '@/lib/dkit/pages'
|
|
3
|
+
|
|
4
|
+
const props = defineProps<{ slug: string }>()
|
|
5
|
+
|
|
6
|
+
const { data: page } = await useAsyncData(`dkit-page-min-${props.slug}`, () =>
|
|
7
|
+
getPageBySlug(props.slug),
|
|
8
|
+
)
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<p v-if="!page">Page not found.</p>
|
|
13
|
+
<article v-else>
|
|
14
|
+
<h1>{{ page.title }}</h1>
|
|
15
|
+
<p v-if="page.published_at">
|
|
16
|
+
<time :datetime="page.published_at">
|
|
17
|
+
{{ new Date(page.published_at).toLocaleDateString() }}
|
|
18
|
+
</time>
|
|
19
|
+
</p>
|
|
20
|
+
<div
|
|
21
|
+
v-if="page.body"
|
|
22
|
+
class="dkit-prose dkit-prose--compact"
|
|
23
|
+
v-html="page.body"
|
|
24
|
+
/>
|
|
25
|
+
</article>
|
|
26
|
+
</template>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { getPageBySlug } from "@/lib/dkit/pages";
|
|
2
|
+
import { moduleHref } from "@/lib/dkit/paths";
|
|
3
|
+
import { buttonVariants } from "@/components/ui/button";
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
|
|
6
|
+
/** Uses your project's shadcn/ui components. */
|
|
7
|
+
export async function PageDetail({
|
|
8
|
+
slug,
|
|
9
|
+
}: {
|
|
10
|
+
slug: string;
|
|
11
|
+
}) {
|
|
12
|
+
const basePath = await moduleHref("pages");
|
|
13
|
+
const page = await getPageBySlug(slug);
|
|
14
|
+
if (!page) {
|
|
15
|
+
return (
|
|
16
|
+
<div className="mx-auto max-w-2xl px-6 py-20 text-center text-muted-foreground">
|
|
17
|
+
<p className="text-2xl font-semibold text-foreground">Page not found</p>
|
|
18
|
+
<a
|
|
19
|
+
href={basePath}
|
|
20
|
+
className={cn(buttonVariants({ variant: "link" }), "mt-4")}
|
|
21
|
+
>
|
|
22
|
+
← Back
|
|
23
|
+
</a>
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<article className="mx-auto max-w-2xl px-6 py-16 sm:py-20">
|
|
30
|
+
<header className="border-b border-border pb-10">
|
|
31
|
+
<h1 className="text-4xl font-semibold leading-[1.15] tracking-tight text-foreground sm:text-5xl">
|
|
32
|
+
{page.title}
|
|
33
|
+
</h1>
|
|
34
|
+
{page.published_at ? (
|
|
35
|
+
<time
|
|
36
|
+
dateTime={page.published_at}
|
|
37
|
+
className="mt-6 block text-sm text-muted-foreground"
|
|
38
|
+
>
|
|
39
|
+
{new Date(page.published_at).toLocaleDateString(undefined, {
|
|
40
|
+
year: "numeric",
|
|
41
|
+
month: "long",
|
|
42
|
+
day: "numeric",
|
|
43
|
+
})}
|
|
44
|
+
</time>
|
|
45
|
+
) : null}
|
|
46
|
+
{page.excerpt ? (
|
|
47
|
+
<p className="mt-4 text-lg leading-relaxed text-muted-foreground">
|
|
48
|
+
{page.excerpt}
|
|
49
|
+
</p>
|
|
50
|
+
) : null}
|
|
51
|
+
</header>
|
|
52
|
+
|
|
53
|
+
{page.body ? (
|
|
54
|
+
<div
|
|
55
|
+
className="dkit-prose mt-10"
|
|
56
|
+
dangerouslySetInnerHTML={{ __html: page.body }}
|
|
57
|
+
/>
|
|
58
|
+
) : null}
|
|
59
|
+
</article>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { getPageBySlug } from '@/lib/dkit/pages'
|
|
3
|
+
import { moduleBasePath } from '@/lib/dkit/config'
|
|
4
|
+
|
|
5
|
+
/** Uses your project's shadcn-vue theme (same layout as Next shadcn page). */
|
|
6
|
+
const props = withDefaults(defineProps<{ slug: string; basePath?: string }>(), {
|
|
7
|
+
basePath: undefined,
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
const resolvedBase = computed(
|
|
11
|
+
() => props.basePath ?? moduleBasePath('pages', '/pages'),
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
const { data: page } = await useAsyncData(`dkit-page-${props.slug}`, () =>
|
|
15
|
+
getPageBySlug(props.slug),
|
|
16
|
+
)
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<div v-if="!page" class="mx-auto max-w-2xl px-6 py-20 text-center text-muted-foreground">
|
|
21
|
+
<p class="text-2xl font-semibold text-foreground">Page not found</p>
|
|
22
|
+
<NuxtLink
|
|
23
|
+
:to="resolvedBase === '/' ? '/' : resolvedBase"
|
|
24
|
+
class="mt-4 inline-block text-sm text-primary underline-offset-4 hover:underline"
|
|
25
|
+
>
|
|
26
|
+
← Back
|
|
27
|
+
</NuxtLink>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<article v-else class="mx-auto max-w-2xl px-6 py-16 sm:py-20">
|
|
31
|
+
<header class="border-b border-border pb-10">
|
|
32
|
+
<h1 class="text-4xl font-semibold leading-[1.15] tracking-tight text-foreground sm:text-5xl">
|
|
33
|
+
{{ page.title }}
|
|
34
|
+
</h1>
|
|
35
|
+
<time
|
|
36
|
+
v-if="page.published_at"
|
|
37
|
+
:datetime="page.published_at"
|
|
38
|
+
class="mt-6 block text-sm text-muted-foreground"
|
|
39
|
+
>
|
|
40
|
+
{{
|
|
41
|
+
new Date(page.published_at).toLocaleDateString(undefined, {
|
|
42
|
+
year: 'numeric',
|
|
43
|
+
month: 'long',
|
|
44
|
+
day: 'numeric',
|
|
45
|
+
})
|
|
46
|
+
}}
|
|
47
|
+
</time>
|
|
48
|
+
<p
|
|
49
|
+
v-if="page.excerpt"
|
|
50
|
+
class="mt-4 text-lg leading-relaxed text-muted-foreground"
|
|
51
|
+
>
|
|
52
|
+
{{ page.excerpt }}
|
|
53
|
+
</p>
|
|
54
|
+
</header>
|
|
55
|
+
|
|
56
|
+
<div
|
|
57
|
+
v-if="page.body"
|
|
58
|
+
class="dkit-prose mt-10"
|
|
59
|
+
v-html="page.body"
|
|
60
|
+
/>
|
|
61
|
+
</article>
|
|
62
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "dkit:block",
|
|
3
|
+
"id": "project-detail",
|
|
4
|
+
"title": "Project detail",
|
|
5
|
+
"description": "Case study page with meta, image, and rich text",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"frameworks": ["next"],
|
|
8
|
+
"uiKits": ["shadcn", "minimal"],
|
|
9
|
+
"shadcnComponents": ["button"],
|
|
10
|
+
"slot": "detail",
|
|
11
|
+
"route": { "kind": "slug" },
|
|
12
|
+
"registryDependencies": ["projects"],
|
|
13
|
+
"dependencies": ["@directus/sdk"],
|
|
14
|
+
"layers": ["ui"]
|
|
15
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { getProjectBySlug, projectImageUrl } from "@/lib/dkit/projects";
|
|
2
|
+
import { moduleHref } from "@/lib/dkit/paths";
|
|
3
|
+
|
|
4
|
+
/** Minimal kit — semantic HTML + dkit-prose only. */
|
|
5
|
+
export async function ProjectDetail({
|
|
6
|
+
slug,
|
|
7
|
+
}: {
|
|
8
|
+
slug: string;
|
|
9
|
+
}) {
|
|
10
|
+
const basePath = await moduleHref("projects");
|
|
11
|
+
const project = await getProjectBySlug(slug);
|
|
12
|
+
if (!project) {
|
|
13
|
+
return (
|
|
14
|
+
<div>
|
|
15
|
+
<p>Project not found.</p>
|
|
16
|
+
<p>
|
|
17
|
+
<a href={basePath}>← Back to projects</a>
|
|
18
|
+
</p>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const imageUrl = projectImageUrl(project);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<article>
|
|
27
|
+
<p>
|
|
28
|
+
<a href={basePath}>← All projects</a>
|
|
29
|
+
</p>
|
|
30
|
+
{imageUrl ? (
|
|
31
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
32
|
+
<img src={imageUrl} alt="" style={{ maxWidth: "100%" }} />
|
|
33
|
+
) : null}
|
|
34
|
+
<h1>{project.title}</h1>
|
|
35
|
+
<p>
|
|
36
|
+
{[project.client, project.location].filter(Boolean).join(" · ")}
|
|
37
|
+
{project.completed_on ? (
|
|
38
|
+
<>
|
|
39
|
+
{(project.client || project.location) && " · "}
|
|
40
|
+
<time dateTime={project.completed_on}>
|
|
41
|
+
{new Date(project.completed_on + "T00:00:00").toLocaleDateString(
|
|
42
|
+
undefined,
|
|
43
|
+
{ year: "numeric", month: "long" },
|
|
44
|
+
)}
|
|
45
|
+
</time>
|
|
46
|
+
</>
|
|
47
|
+
) : null}
|
|
48
|
+
</p>
|
|
49
|
+
{project.summary ? <p>{project.summary}</p> : null}
|
|
50
|
+
{project.body ? (
|
|
51
|
+
<div
|
|
52
|
+
className="dkit-prose dkit-prose--compact"
|
|
53
|
+
dangerouslySetInnerHTML={{ __html: project.body }}
|
|
54
|
+
/>
|
|
55
|
+
) : null}
|
|
56
|
+
</article>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { getProjectBySlug, projectImageUrl } from "@/lib/dkit/projects";
|
|
2
|
+
import { moduleHref } from "@/lib/dkit/paths";
|
|
3
|
+
import { buttonVariants } from "@/components/ui/button";
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
|
|
6
|
+
/** Uses your project's shadcn/ui components. */
|
|
7
|
+
export async function ProjectDetail({
|
|
8
|
+
slug,
|
|
9
|
+
}: {
|
|
10
|
+
slug: string;
|
|
11
|
+
}) {
|
|
12
|
+
const basePath = await moduleHref("projects");
|
|
13
|
+
const project = await getProjectBySlug(slug);
|
|
14
|
+
if (!project) {
|
|
15
|
+
return (
|
|
16
|
+
<div className="mx-auto max-w-2xl px-6 py-20 text-center text-muted-foreground">
|
|
17
|
+
<p className="text-2xl font-semibold text-foreground">
|
|
18
|
+
Project not found
|
|
19
|
+
</p>
|
|
20
|
+
<a
|
|
21
|
+
href={basePath}
|
|
22
|
+
className={cn(buttonVariants({ variant: "link" }), "mt-4")}
|
|
23
|
+
>
|
|
24
|
+
← Back to projects
|
|
25
|
+
</a>
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const imageUrl = projectImageUrl(project);
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<article className="mx-auto max-w-2xl px-6 py-16 sm:py-20">
|
|
34
|
+
<a
|
|
35
|
+
href={basePath}
|
|
36
|
+
className={cn(buttonVariants({ variant: "ghost" }), "mb-10")}
|
|
37
|
+
>
|
|
38
|
+
← All projects
|
|
39
|
+
</a>
|
|
40
|
+
|
|
41
|
+
{imageUrl ? (
|
|
42
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
43
|
+
<img
|
|
44
|
+
src={imageUrl}
|
|
45
|
+
alt=""
|
|
46
|
+
className="mb-10 aspect-[16/9] w-full rounded-xl object-cover ring-1 ring-border"
|
|
47
|
+
/>
|
|
48
|
+
) : null}
|
|
49
|
+
|
|
50
|
+
<header className="border-b border-border pb-10">
|
|
51
|
+
<h1 className="text-4xl font-semibold leading-[1.15] tracking-tight text-foreground sm:text-5xl">
|
|
52
|
+
{project.title}
|
|
53
|
+
</h1>
|
|
54
|
+
<div className="mt-6 flex flex-wrap items-center gap-x-3 gap-y-1 text-sm text-muted-foreground">
|
|
55
|
+
{project.client ? (
|
|
56
|
+
<span className="font-medium text-foreground">
|
|
57
|
+
{project.client}
|
|
58
|
+
</span>
|
|
59
|
+
) : null}
|
|
60
|
+
{project.client && project.location ? (
|
|
61
|
+
<span aria-hidden>·</span>
|
|
62
|
+
) : null}
|
|
63
|
+
{project.location ? <span>{project.location}</span> : null}
|
|
64
|
+
{(project.client || project.location) && project.completed_on ? (
|
|
65
|
+
<span aria-hidden>·</span>
|
|
66
|
+
) : null}
|
|
67
|
+
{project.completed_on ? (
|
|
68
|
+
<time dateTime={project.completed_on}>
|
|
69
|
+
{new Date(project.completed_on + "T00:00:00").toLocaleDateString(
|
|
70
|
+
undefined,
|
|
71
|
+
{ year: "numeric", month: "long" },
|
|
72
|
+
)}
|
|
73
|
+
</time>
|
|
74
|
+
) : null}
|
|
75
|
+
</div>
|
|
76
|
+
{project.summary ? (
|
|
77
|
+
<p className="mt-4 text-base leading-relaxed text-muted-foreground">
|
|
78
|
+
{project.summary}
|
|
79
|
+
</p>
|
|
80
|
+
) : null}
|
|
81
|
+
</header>
|
|
82
|
+
|
|
83
|
+
{project.body ? (
|
|
84
|
+
<div
|
|
85
|
+
className="dkit-prose mt-10"
|
|
86
|
+
dangerouslySetInnerHTML={{ __html: project.body }}
|
|
87
|
+
/>
|
|
88
|
+
) : null}
|
|
89
|
+
</article>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "dkit:block",
|
|
3
|
+
"id": "project-list",
|
|
4
|
+
"title": "Project list",
|
|
5
|
+
"description": "Stacked project list with optional thumbnails",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"frameworks": ["next"],
|
|
8
|
+
"uiKits": ["shadcn", "minimal"],
|
|
9
|
+
"slot": "list",
|
|
10
|
+
"route": { "kind": "index" },
|
|
11
|
+
"registryDependencies": ["projects"],
|
|
12
|
+
"dependencies": ["@directus/sdk"],
|
|
13
|
+
"layers": ["ui"]
|
|
14
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { getProjects, projectImageUrl } from "@/lib/dkit/projects";
|
|
2
|
+
import { moduleHref } from "@/lib/dkit/paths";
|
|
3
|
+
|
|
4
|
+
/** Minimal kit — stacked list (shared type primitives). */
|
|
5
|
+
export async function ProjectList() {
|
|
6
|
+
const projects = await getProjects();
|
|
7
|
+
const hrefById = Object.fromEntries(
|
|
8
|
+
await Promise.all(
|
|
9
|
+
projects.map(async (project) => [project.id, await moduleHref("projects", project.slug)] as const),
|
|
10
|
+
),
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<section>
|
|
15
|
+
<style>{`
|
|
16
|
+
.dkit-project-list {
|
|
17
|
+
list-style: none;
|
|
18
|
+
margin: 0;
|
|
19
|
+
padding: 0;
|
|
20
|
+
}
|
|
21
|
+
.dkit-project-list > li {
|
|
22
|
+
display: flex;
|
|
23
|
+
gap: 1rem;
|
|
24
|
+
padding: 1rem 0;
|
|
25
|
+
border-bottom: 1px solid var(--dkit-border, #ddd);
|
|
26
|
+
}
|
|
27
|
+
.dkit-project-list > li:last-child {
|
|
28
|
+
border-bottom: 0;
|
|
29
|
+
}
|
|
30
|
+
.dkit-project-list__thumb {
|
|
31
|
+
flex: 0 0 auto;
|
|
32
|
+
width: 4rem;
|
|
33
|
+
height: 4rem;
|
|
34
|
+
object-fit: cover;
|
|
35
|
+
}
|
|
36
|
+
.dkit-project-list__body {
|
|
37
|
+
min-width: 0;
|
|
38
|
+
flex: 1;
|
|
39
|
+
}
|
|
40
|
+
.dkit-project-list__title {
|
|
41
|
+
margin: 0 0 0.25rem;
|
|
42
|
+
font-size: 1.25rem;
|
|
43
|
+
}
|
|
44
|
+
.dkit-project-list__meta {
|
|
45
|
+
margin: 0.5rem 0 0;
|
|
46
|
+
font-size: 0.875rem;
|
|
47
|
+
color: var(--dkit-muted, #666);
|
|
48
|
+
}
|
|
49
|
+
.dkit-project-list__summary {
|
|
50
|
+
margin: 0.5rem 0 0;
|
|
51
|
+
color: var(--dkit-muted, #555);
|
|
52
|
+
}
|
|
53
|
+
`}</style>
|
|
54
|
+
|
|
55
|
+
<header>
|
|
56
|
+
<p className="dkit-label">Portfolio</p>
|
|
57
|
+
<h1 className="dkit-headline">Projects</h1>
|
|
58
|
+
</header>
|
|
59
|
+
|
|
60
|
+
{projects.length === 0 ? (
|
|
61
|
+
<p>No published projects yet.</p>
|
|
62
|
+
) : (
|
|
63
|
+
<ul className="dkit-project-list">
|
|
64
|
+
{projects.map((project) => {
|
|
65
|
+
const imageUrl = projectImageUrl(project);
|
|
66
|
+
return (
|
|
67
|
+
<li key={project.id}>
|
|
68
|
+
{imageUrl ? (
|
|
69
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
70
|
+
<img
|
|
71
|
+
className="dkit-project-list__thumb"
|
|
72
|
+
src={imageUrl}
|
|
73
|
+
alt=""
|
|
74
|
+
width={64}
|
|
75
|
+
height={64}
|
|
76
|
+
/>
|
|
77
|
+
) : null}
|
|
78
|
+
<div className="dkit-project-list__body">
|
|
79
|
+
<h2 className="dkit-project-list__title">
|
|
80
|
+
<a href={hrefById[project.id]!}>
|
|
81
|
+
{project.title}
|
|
82
|
+
</a>
|
|
83
|
+
</h2>
|
|
84
|
+
{project.client || project.location ? (
|
|
85
|
+
<p className="dkit-project-list__meta">
|
|
86
|
+
{[project.client, project.location]
|
|
87
|
+
.filter(Boolean)
|
|
88
|
+
.join(" · ")}
|
|
89
|
+
</p>
|
|
90
|
+
) : null}
|
|
91
|
+
{project.summary ? (
|
|
92
|
+
<p className="dkit-project-list__summary">
|
|
93
|
+
{project.summary}
|
|
94
|
+
</p>
|
|
95
|
+
) : null}
|
|
96
|
+
</div>
|
|
97
|
+
</li>
|
|
98
|
+
);
|
|
99
|
+
})}
|
|
100
|
+
</ul>
|
|
101
|
+
)}
|
|
102
|
+
</section>
|
|
103
|
+
);
|
|
104
|
+
}
|