@opinly/next 0.1.25 → 1.0.0-alpha.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/dist/config.cjs +16 -7
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.cts +7 -2
- package/dist/config.d.ts +7 -2
- package/dist/config.js +16 -7
- package/dist/config.js.map +1 -1
- package/dist/index.cjs +33 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -6
- package/dist/index.d.ts +12 -6
- package/dist/index.js +26 -1
- package/dist/index.js.map +1 -1
- package/dist/json-ld.cjs +61 -0
- package/dist/json-ld.cjs.map +1 -0
- package/dist/json-ld.d.cts +17 -0
- package/dist/json-ld.d.ts +17 -0
- package/dist/json-ld.js +38 -0
- package/dist/json-ld.js.map +1 -0
- package/dist/utils/generate-metadata.cjs +23 -32
- package/dist/utils/generate-metadata.cjs.map +1 -1
- package/dist/utils/generate-metadata.d.cts +11 -2
- package/dist/utils/generate-metadata.d.ts +11 -2
- package/dist/utils/generate-metadata.js +23 -32
- package/dist/utils/generate-metadata.js.map +1 -1
- package/dist/utils/generate-sitemap-xml.cjs.map +1 -1
- package/dist/utils/generate-sitemap-xml.d.cts +5 -3
- package/dist/utils/generate-sitemap-xml.d.ts +5 -3
- package/dist/utils/generate-sitemap-xml.js.map +1 -1
- package/dist/utils/sdk-config.cjs +6 -2
- package/dist/utils/sdk-config.cjs.map +1 -1
- package/dist/utils/sdk-config.d.cts +4 -0
- package/dist/utils/sdk-config.d.ts +4 -0
- package/dist/utils/sdk-config.js +6 -2
- package/dist/utils/sdk-config.js.map +1 -1
- package/package.json +9 -23
- package/dist/components/author-page/_helpers/json-ld.cjs +0 -44
- package/dist/components/author-page/_helpers/json-ld.cjs.map +0 -1
- package/dist/components/author-page/_helpers/json-ld.d.cts +0 -8
- package/dist/components/author-page/_helpers/json-ld.d.ts +0 -8
- package/dist/components/author-page/_helpers/json-ld.js +0 -20
- package/dist/components/author-page/_helpers/json-ld.js.map +0 -1
- package/dist/components/author-page/index.cjs +0 -104
- package/dist/components/author-page/index.cjs.map +0 -1
- package/dist/components/author-page/index.d.cts +0 -10
- package/dist/components/author-page/index.d.ts +0 -10
- package/dist/components/author-page/index.js +0 -70
- package/dist/components/author-page/index.js.map +0 -1
- package/dist/components/authors-page/_helpers/json-ld.cjs +0 -53
- package/dist/components/authors-page/_helpers/json-ld.cjs.map +0 -1
- package/dist/components/authors-page/_helpers/json-ld.d.cts +0 -8
- package/dist/components/authors-page/_helpers/json-ld.d.ts +0 -8
- package/dist/components/authors-page/_helpers/json-ld.js +0 -29
- package/dist/components/authors-page/_helpers/json-ld.js.map +0 -1
- package/dist/components/authors-page/index.cjs +0 -121
- package/dist/components/authors-page/index.cjs.map +0 -1
- package/dist/components/authors-page/index.d.cts +0 -10
- package/dist/components/authors-page/index.d.ts +0 -10
- package/dist/components/authors-page/index.js +0 -87
- package/dist/components/authors-page/index.js.map +0 -1
- package/dist/components/blog-post/_components/content.cjs +0 -157
- package/dist/components/blog-post/_components/content.cjs.map +0 -1
- package/dist/components/blog-post/_components/content.d.cts +0 -10
- package/dist/components/blog-post/_components/content.d.ts +0 -10
- package/dist/components/blog-post/_components/content.js +0 -123
- package/dist/components/blog-post/_components/content.js.map +0 -1
- package/dist/components/blog-post/_components/faq.cjs +0 -39
- package/dist/components/blog-post/_components/faq.cjs.map +0 -1
- package/dist/components/blog-post/_components/faq.d.cts +0 -9
- package/dist/components/blog-post/_components/faq.d.ts +0 -9
- package/dist/components/blog-post/_components/faq.js +0 -15
- package/dist/components/blog-post/_components/faq.js.map +0 -1
- package/dist/components/blog-post/_components/share.cjs +0 -100
- package/dist/components/blog-post/_components/share.cjs.map +0 -1
- package/dist/components/blog-post/_components/share.d.cts +0 -9
- package/dist/components/blog-post/_components/share.d.ts +0 -9
- package/dist/components/blog-post/_components/share.js +0 -66
- package/dist/components/blog-post/_components/share.js.map +0 -1
- package/dist/components/blog-post/_components/table-of-contents.cjs +0 -111
- package/dist/components/blog-post/_components/table-of-contents.cjs.map +0 -1
- package/dist/components/blog-post/_components/table-of-contents.d.cts +0 -14
- package/dist/components/blog-post/_components/table-of-contents.d.ts +0 -14
- package/dist/components/blog-post/_components/table-of-contents.js +0 -77
- package/dist/components/blog-post/_components/table-of-contents.js.map +0 -1
- package/dist/components/blog-post/_helpers/calc-reading-time.cjs +0 -2
- package/dist/components/blog-post/_helpers/calc-reading-time.cjs.map +0 -1
- package/dist/components/blog-post/_helpers/calc-reading-time.d.cts +0 -2
- package/dist/components/blog-post/_helpers/calc-reading-time.d.ts +0 -2
- package/dist/components/blog-post/_helpers/calc-reading-time.js +0 -1
- package/dist/components/blog-post/_helpers/calc-reading-time.js.map +0 -1
- package/dist/components/blog-post/_helpers/extract-headings.cjs +0 -45
- package/dist/components/blog-post/_helpers/extract-headings.cjs.map +0 -1
- package/dist/components/blog-post/_helpers/extract-headings.d.cts +0 -9
- package/dist/components/blog-post/_helpers/extract-headings.d.ts +0 -9
- package/dist/components/blog-post/_helpers/extract-headings.js +0 -21
- package/dist/components/blog-post/_helpers/extract-headings.js.map +0 -1
- package/dist/components/blog-post/_helpers/json-ld.cjs +0 -162
- package/dist/components/blog-post/_helpers/json-ld.cjs.map +0 -1
- package/dist/components/blog-post/_helpers/json-ld.d.cts +0 -15
- package/dist/components/blog-post/_helpers/json-ld.d.ts +0 -15
- package/dist/components/blog-post/_helpers/json-ld.js +0 -135
- package/dist/components/blog-post/_helpers/json-ld.js.map +0 -1
- package/dist/components/blog-post/_helpers/reading-time.cjs +0 -50
- package/dist/components/blog-post/_helpers/reading-time.cjs.map +0 -1
- package/dist/components/blog-post/_helpers/reading-time.d.cts +0 -6
- package/dist/components/blog-post/_helpers/reading-time.d.ts +0 -6
- package/dist/components/blog-post/_helpers/reading-time.js +0 -25
- package/dist/components/blog-post/_helpers/reading-time.js.map +0 -1
- package/dist/components/blog-post/_types/blog-post.cjs +0 -17
- package/dist/components/blog-post/_types/blog-post.cjs.map +0 -1
- package/dist/components/blog-post/_types/blog-post.d.cts +0 -7
- package/dist/components/blog-post/_types/blog-post.d.ts +0 -7
- package/dist/components/blog-post/_types/blog-post.js +0 -1
- package/dist/components/blog-post/_types/blog-post.js.map +0 -1
- package/dist/components/blog-post/_types/class-names.cjs +0 -17
- package/dist/components/blog-post/_types/class-names.cjs.map +0 -1
- package/dist/components/blog-post/_types/class-names.d.cts +0 -12
- package/dist/components/blog-post/_types/class-names.d.ts +0 -12
- package/dist/components/blog-post/_types/class-names.js +0 -1
- package/dist/components/blog-post/_types/class-names.js.map +0 -1
- package/dist/components/blog-post/index.cjs +0 -134
- package/dist/components/blog-post/index.cjs.map +0 -1
- package/dist/components/blog-post/index.d.cts +0 -15
- package/dist/components/blog-post/index.d.ts +0 -15
- package/dist/components/blog-post/index.js +0 -100
- package/dist/components/blog-post/index.js.map +0 -1
- package/dist/components/bread-crumbs.cjs +0 -60
- package/dist/components/bread-crumbs.cjs.map +0 -1
- package/dist/components/bread-crumbs.d.cts +0 -10
- package/dist/components/bread-crumbs.d.ts +0 -10
- package/dist/components/bread-crumbs.js +0 -26
- package/dist/components/bread-crumbs.js.map +0 -1
- package/dist/components/folder-page/_helpers/json-ld.cjs +0 -43
- package/dist/components/folder-page/_helpers/json-ld.cjs.map +0 -1
- package/dist/components/folder-page/_helpers/json-ld.d.cts +0 -8
- package/dist/components/folder-page/_helpers/json-ld.d.ts +0 -8
- package/dist/components/folder-page/_helpers/json-ld.js +0 -19
- package/dist/components/folder-page/_helpers/json-ld.js.map +0 -1
- package/dist/components/folder-page/index.cjs +0 -84
- package/dist/components/folder-page/index.cjs.map +0 -1
- package/dist/components/folder-page/index.d.cts +0 -10
- package/dist/components/folder-page/index.d.ts +0 -10
- package/dist/components/folder-page/index.js +0 -60
- package/dist/components/folder-page/index.js.map +0 -1
- package/dist/components/home-page/_helpers/json-ld.cjs +0 -43
- package/dist/components/home-page/_helpers/json-ld.cjs.map +0 -1
- package/dist/components/home-page/_helpers/json-ld.d.cts +0 -3
- package/dist/components/home-page/_helpers/json-ld.d.ts +0 -3
- package/dist/components/home-page/_helpers/json-ld.js +0 -19
- package/dist/components/home-page/_helpers/json-ld.js.map +0 -1
- package/dist/components/home-page/folders.cjs +0 -108
- package/dist/components/home-page/folders.cjs.map +0 -1
- package/dist/components/home-page/folders.d.cts +0 -11
- package/dist/components/home-page/folders.d.ts +0 -11
- package/dist/components/home-page/folders.js +0 -73
- package/dist/components/home-page/folders.js.map +0 -1
- package/dist/components/home-page/index.cjs +0 -50
- package/dist/components/home-page/index.cjs.map +0 -1
- package/dist/components/home-page/index.d.cts +0 -14
- package/dist/components/home-page/index.d.ts +0 -14
- package/dist/components/home-page/index.js +0 -26
- package/dist/components/home-page/index.js.map +0 -1
- package/dist/components/home-page/pagination.cjs +0 -97
- package/dist/components/home-page/pagination.cjs.map +0 -1
- package/dist/components/home-page/pagination.d.cts +0 -9
- package/dist/components/home-page/pagination.d.ts +0 -9
- package/dist/components/home-page/pagination.js +0 -63
- package/dist/components/home-page/pagination.js.map +0 -1
- package/dist/components/home-page/top-posts.cjs +0 -35
- package/dist/components/home-page/top-posts.cjs.map +0 -1
- package/dist/components/home-page/top-posts.d.cts +0 -10
- package/dist/components/home-page/top-posts.d.ts +0 -10
- package/dist/components/home-page/top-posts.js +0 -11
- package/dist/components/home-page/top-posts.js.map +0 -1
- package/dist/components/json-ld.cjs +0 -92
- package/dist/components/json-ld.cjs.map +0 -1
- package/dist/components/json-ld.d.cts +0 -13
- package/dist/components/json-ld.d.ts +0 -13
- package/dist/components/json-ld.js +0 -57
- package/dist/components/json-ld.js.map +0 -1
- package/dist/components/opinly-blog.cjs +0 -59
- package/dist/components/opinly-blog.cjs.map +0 -1
- package/dist/components/opinly-blog.d.cts +0 -16
- package/dist/components/opinly-blog.d.ts +0 -16
- package/dist/components/opinly-blog.js +0 -35
- package/dist/components/opinly-blog.js.map +0 -1
- package/dist/components/post-preview.cjs +0 -114
- package/dist/components/post-preview.cjs.map +0 -1
- package/dist/components/post-preview.d.cts +0 -10
- package/dist/components/post-preview.d.ts +0 -10
- package/dist/components/post-preview.js +0 -79
- package/dist/components/post-preview.js.map +0 -1
- package/dist/pages/index.cjs +0 -23
- package/dist/pages/index.cjs.map +0 -1
- package/dist/pages/index.d.cts +0 -3
- package/dist/pages/index.d.ts +0 -3
- package/dist/pages/index.js +0 -2
- package/dist/pages/index.js.map +0 -1
- package/dist/pages/opinly-blog-pages.cjs +0 -127
- package/dist/pages/opinly-blog-pages.cjs.map +0 -1
- package/dist/pages/opinly-blog-pages.d.cts +0 -9
- package/dist/pages/opinly-blog-pages.d.ts +0 -9
- package/dist/pages/opinly-blog-pages.js +0 -103
- package/dist/pages/opinly-blog-pages.js.map +0 -1
- package/dist/utils/json-ld.cjs +0 -2
- package/dist/utils/json-ld.cjs.map +0 -1
- package/dist/utils/json-ld.d.cts +0 -2
- package/dist/utils/json-ld.d.ts +0 -2
- package/dist/utils/json-ld.js +0 -1
- package/dist/utils/json-ld.js.map +0 -1
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import Image from "next/image";
|
|
3
|
-
import { opinlyConfig } from "../../utils/sdk-config";
|
|
4
|
-
import { PostPreview } from "../post-preview";
|
|
5
|
-
import { BreadCrumbs } from "../bread-crumbs";
|
|
6
|
-
import { OpinlyBreadCrumbJsonLd, OpinlyJSONLD } from "../json-ld";
|
|
7
|
-
import { genPersonPostingJSONLD } from "./_helpers/json-ld";
|
|
8
|
-
const AuthorPage = ({
|
|
9
|
-
author
|
|
10
|
-
}) => {
|
|
11
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12
|
-
/* @__PURE__ */ jsx(
|
|
13
|
-
OpinlyBreadCrumbJsonLd,
|
|
14
|
-
{
|
|
15
|
-
items: [
|
|
16
|
-
{
|
|
17
|
-
slugNoPrefixSlash: "authors",
|
|
18
|
-
name: "Authors"
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
slugNoPrefixSlash: `authors/${author.slug}`,
|
|
22
|
-
name: author.name
|
|
23
|
-
}
|
|
24
|
-
]
|
|
25
|
-
}
|
|
26
|
-
),
|
|
27
|
-
/* @__PURE__ */ jsx(OpinlyJSONLD, { content: genPersonPostingJSONLD(author) }),
|
|
28
|
-
/* @__PURE__ */ jsxs("div", { className: "max-w-5xl mx-auto px-4 py-10", children: [
|
|
29
|
-
/* @__PURE__ */ jsx(
|
|
30
|
-
BreadCrumbs,
|
|
31
|
-
{
|
|
32
|
-
breadcrumbs: [
|
|
33
|
-
{
|
|
34
|
-
name: "Authors",
|
|
35
|
-
url: `${opinlyConfig.blogPrefix}/authors`
|
|
36
|
-
}
|
|
37
|
-
]
|
|
38
|
-
}
|
|
39
|
-
),
|
|
40
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-6 mb-10", children: [
|
|
41
|
-
author.image.fileKey && /* @__PURE__ */ jsx(
|
|
42
|
-
Image,
|
|
43
|
-
{
|
|
44
|
-
unoptimized: opinlyConfig.unoptimizedImages,
|
|
45
|
-
src: `${opinlyConfig.imagesPrefix}/${author.image.fileKey}`,
|
|
46
|
-
alt: author.image.alt || author.name,
|
|
47
|
-
width: 150,
|
|
48
|
-
height: 150,
|
|
49
|
-
className: "rounded-full border"
|
|
50
|
-
}
|
|
51
|
-
),
|
|
52
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
53
|
-
/* @__PURE__ */ jsx("h1", { className: "text-3xl font-bold mb-1", children: author.name }),
|
|
54
|
-
author.bio && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-base max-w-2xl", children: author.bio })
|
|
55
|
-
] })
|
|
56
|
-
] }),
|
|
57
|
-
/* @__PURE__ */ jsxs("h2", { className: "text-xl font-semibold mb-6", children: [
|
|
58
|
-
"Posts by ",
|
|
59
|
-
author.name
|
|
60
|
-
] }),
|
|
61
|
-
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8", children: author.posts && author.posts.length > 0 ? author.posts.map(
|
|
62
|
-
(post) => post && /* @__PURE__ */ jsx(PostPreview, { post }, post.slug)
|
|
63
|
-
) : /* @__PURE__ */ jsx("div", { className: "text-muted-foreground col-span-full", children: "No posts yet." }) })
|
|
64
|
-
] })
|
|
65
|
-
] });
|
|
66
|
-
};
|
|
67
|
-
export {
|
|
68
|
-
AuthorPage
|
|
69
|
-
};
|
|
70
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/author-page/index.tsx"],"sourcesContent":["import { Opinly } from \"@opinly/backend\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../../utils/sdk-config\";\nimport { PostPreview } from \"../post-preview\";\nimport { BreadCrumbs } from \"../bread-crumbs\";\nimport { OpinlyBreadCrumbJsonLd, OpinlyJSONLD } from \"../json-ld\";\nimport { genPersonPostingJSONLD } from \"./_helpers/json-ld\";\n\nexport const AuthorPage = ({\n author,\n}: {\n author: Extract<\n Awaited<ReturnType<Opinly[\"content\"][\"blog\"]>>,\n { type: \"author\" }\n >[\"data\"];\n}) => {\n return (\n <>\n <OpinlyBreadCrumbJsonLd\n items={[\n {\n slugNoPrefixSlash: \"authors\",\n name: \"Authors\",\n },\n {\n slugNoPrefixSlash: `authors/${author.slug}`,\n name: author.name,\n },\n ]}\n />\n <OpinlyJSONLD content={genPersonPostingJSONLD(author)} />\n\n <div className=\"max-w-5xl mx-auto px-4 py-10\">\n <BreadCrumbs\n breadcrumbs={[\n {\n name: \"Authors\",\n url: `${opinlyConfig.blogPrefix}/authors`,\n },\n ]}\n />\n {/* Author Header */}\n <div className=\"flex items-center gap-6 mb-10\">\n {author.image.fileKey && (\n <Image\n unoptimized={opinlyConfig.unoptimizedImages}\n src={`${opinlyConfig.imagesPrefix}/${author.image.fileKey}`}\n alt={author.image.alt || author.name}\n width={150}\n height={150}\n className=\"rounded-full border\"\n />\n )}\n <div>\n <h1 className=\"text-3xl font-bold mb-1\">{author.name}</h1>\n {author.bio && (\n <p className=\"text-muted-foreground text-base max-w-2xl\">\n {author.bio}\n </p>\n )}\n </div>\n </div>\n\n {/* Posts Grid */}\n <h2 className=\"text-xl font-semibold mb-6\">Posts by {author.name}</h2>\n <div className=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8\">\n {author.posts && author.posts.length > 0 ? (\n author.posts.map(\n (post) => post && <PostPreview key={post.slug} post={post} />\n )\n ) : (\n <div className=\"text-muted-foreground col-span-full\">\n No posts yet.\n </div>\n )}\n </div>\n </div>\n </>\n );\n};\n"],"mappings":"AAiBI,mBACE,KAmCI,YApCN;AAhBJ,OAAO,WAAW;AAClB,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,wBAAwB,oBAAoB;AACrD,SAAS,8BAA8B;AAEhC,MAAM,aAAa,CAAC;AAAA,EACzB;AACF,MAKM;AACJ,SACE,iCACE;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,OAAO;AAAA,UACL;AAAA,YACE,mBAAmB;AAAA,YACnB,MAAM;AAAA,UACR;AAAA,UACA;AAAA,YACE,mBAAmB,WAAW,OAAO,IAAI;AAAA,YACzC,MAAM,OAAO;AAAA,UACf;AAAA,QACF;AAAA;AAAA,IACF;AAAA,IACA,oBAAC,gBAAa,SAAS,uBAAuB,MAAM,GAAG;AAAA,IAEvD,qBAAC,SAAI,WAAU,gCACb;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,aAAa;AAAA,YACX;AAAA,cACE,MAAM;AAAA,cACN,KAAK,GAAG,aAAa,UAAU;AAAA,YACjC;AAAA,UACF;AAAA;AAAA,MACF;AAAA,MAEA,qBAAC,SAAI,WAAU,iCACZ;AAAA,eAAO,MAAM,WACZ;AAAA,UAAC;AAAA;AAAA,YACC,aAAa,aAAa;AAAA,YAC1B,KAAK,GAAG,aAAa,YAAY,IAAI,OAAO,MAAM,OAAO;AAAA,YACzD,KAAK,OAAO,MAAM,OAAO,OAAO;AAAA,YAChC,OAAO;AAAA,YACP,QAAQ;AAAA,YACR,WAAU;AAAA;AAAA,QACZ;AAAA,QAEF,qBAAC,SACC;AAAA,8BAAC,QAAG,WAAU,2BAA2B,iBAAO,MAAK;AAAA,UACpD,OAAO,OACN,oBAAC,OAAE,WAAU,6CACV,iBAAO,KACV;AAAA,WAEJ;AAAA,SACF;AAAA,MAGA,qBAAC,QAAG,WAAU,8BAA6B;AAAA;AAAA,QAAU,OAAO;AAAA,SAAK;AAAA,MACjE,oBAAC,SAAI,WAAU,wDACZ,iBAAO,SAAS,OAAO,MAAM,SAAS,IACrC,OAAO,MAAM;AAAA,QACX,CAAC,SAAS,QAAQ,oBAAC,eAA4B,QAAX,KAAK,IAAkB;AAAA,MAC7D,IAEA,oBAAC,SAAI,WAAU,uCAAsC,2BAErD,GAEJ;AAAA,OACF;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var json_ld_exports = {};
|
|
20
|
-
__export(json_ld_exports, {
|
|
21
|
-
authorCollectionJSONLD: () => authorCollectionJSONLD
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(json_ld_exports);
|
|
24
|
-
var import_sdk_config = require("../../../utils/sdk-config");
|
|
25
|
-
const authorCollectionJSONLD = (authors) => {
|
|
26
|
-
const jsonLD = {
|
|
27
|
-
"@context": "https://schema.org",
|
|
28
|
-
"@type": "CollectionPage",
|
|
29
|
-
name: "Authors",
|
|
30
|
-
description: `Meet the authors of the ${import_sdk_config.opinlyConfig.siteName} blog`,
|
|
31
|
-
url: `${import_sdk_config.opinlyConfig.blogUrl}/authors`,
|
|
32
|
-
publisher: {
|
|
33
|
-
"@type": "Organization",
|
|
34
|
-
name: import_sdk_config.opinlyConfig.siteName
|
|
35
|
-
},
|
|
36
|
-
mainEntity: authors.map((author) => ({
|
|
37
|
-
"@type": "Person",
|
|
38
|
-
name: author.name,
|
|
39
|
-
url: `${import_sdk_config.opinlyConfig.blogUrl}/authors/${author.slug}`,
|
|
40
|
-
image: author.image?.fileKey ? {
|
|
41
|
-
"@type": "ImageObject",
|
|
42
|
-
url: `${import_sdk_config.opinlyConfig.imagesUrl}/${author.image.fileKey}`
|
|
43
|
-
} : void 0,
|
|
44
|
-
description: author.bio || void 0
|
|
45
|
-
}))
|
|
46
|
-
};
|
|
47
|
-
return JSON.stringify(jsonLD);
|
|
48
|
-
};
|
|
49
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
-
0 && (module.exports = {
|
|
51
|
-
authorCollectionJSONLD
|
|
52
|
-
});
|
|
53
|
-
//# sourceMappingURL=json-ld.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/authors-page/_helpers/json-ld.ts"],"sourcesContent":["import { Opinly } from \"@opinly/backend\";\nimport { CollectionPage, WithContext } from \"schema-dts\";\nimport { opinlyConfig } from \"../../../utils/sdk-config\";\n\ntype AuthorRes = Extract<\n Awaited<ReturnType<Opinly[\"content\"][\"blog\"]>>,\n { type: \"authors\" }\n>[\"data\"];\n\nexport const authorCollectionJSONLD = (authors: AuthorRes) => {\n const jsonLD: WithContext<CollectionPage> = {\n \"@context\": \"https://schema.org\",\n \"@type\": \"CollectionPage\",\n name: \"Authors\",\n description: `Meet the authors of the ${opinlyConfig.siteName} blog`,\n url: `${opinlyConfig.blogUrl}/authors`,\n publisher: {\n \"@type\": \"Organization\",\n name: opinlyConfig.siteName,\n },\n mainEntity: authors.map((author) => ({\n \"@type\": \"Person\",\n name: author.name,\n url: `${opinlyConfig.blogUrl}/authors/${author.slug}`,\n image: author.image?.fileKey\n ? {\n \"@type\": \"ImageObject\",\n url: `${opinlyConfig.imagesUrl}/${author.image.fileKey}`,\n }\n : undefined,\n description: author.bio || undefined,\n })),\n };\n\n return JSON.stringify(jsonLD);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,wBAA6B;AAOtB,MAAM,yBAAyB,CAAC,YAAuB;AAC5D,QAAM,SAAsC;AAAA,IAC1C,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,MAAM;AAAA,IACN,aAAa,2BAA2B,+BAAa,QAAQ;AAAA,IAC7D,KAAK,GAAG,+BAAa,OAAO;AAAA,IAC5B,WAAW;AAAA,MACT,SAAS;AAAA,MACT,MAAM,+BAAa;AAAA,IACrB;AAAA,IACA,YAAY,QAAQ,IAAI,CAAC,YAAY;AAAA,MACnC,SAAS;AAAA,MACT,MAAM,OAAO;AAAA,MACb,KAAK,GAAG,+BAAa,OAAO,YAAY,OAAO,IAAI;AAAA,MACnD,OAAO,OAAO,OAAO,UACjB;AAAA,QACE,SAAS;AAAA,QACT,KAAK,GAAG,+BAAa,SAAS,IAAI,OAAO,MAAM,OAAO;AAAA,MACxD,IACA;AAAA,MACJ,aAAa,OAAO,OAAO;AAAA,IAC7B,EAAE;AAAA,EACJ;AAEA,SAAO,KAAK,UAAU,MAAM;AAC9B;","names":[]}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { opinlyConfig } from "../../../utils/sdk-config";
|
|
2
|
-
const authorCollectionJSONLD = (authors) => {
|
|
3
|
-
const jsonLD = {
|
|
4
|
-
"@context": "https://schema.org",
|
|
5
|
-
"@type": "CollectionPage",
|
|
6
|
-
name: "Authors",
|
|
7
|
-
description: `Meet the authors of the ${opinlyConfig.siteName} blog`,
|
|
8
|
-
url: `${opinlyConfig.blogUrl}/authors`,
|
|
9
|
-
publisher: {
|
|
10
|
-
"@type": "Organization",
|
|
11
|
-
name: opinlyConfig.siteName
|
|
12
|
-
},
|
|
13
|
-
mainEntity: authors.map((author) => ({
|
|
14
|
-
"@type": "Person",
|
|
15
|
-
name: author.name,
|
|
16
|
-
url: `${opinlyConfig.blogUrl}/authors/${author.slug}`,
|
|
17
|
-
image: author.image?.fileKey ? {
|
|
18
|
-
"@type": "ImageObject",
|
|
19
|
-
url: `${opinlyConfig.imagesUrl}/${author.image.fileKey}`
|
|
20
|
-
} : void 0,
|
|
21
|
-
description: author.bio || void 0
|
|
22
|
-
}))
|
|
23
|
-
};
|
|
24
|
-
return JSON.stringify(jsonLD);
|
|
25
|
-
};
|
|
26
|
-
export {
|
|
27
|
-
authorCollectionJSONLD
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=json-ld.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/authors-page/_helpers/json-ld.ts"],"sourcesContent":["import { Opinly } from \"@opinly/backend\";\nimport { CollectionPage, WithContext } from \"schema-dts\";\nimport { opinlyConfig } from \"../../../utils/sdk-config\";\n\ntype AuthorRes = Extract<\n Awaited<ReturnType<Opinly[\"content\"][\"blog\"]>>,\n { type: \"authors\" }\n>[\"data\"];\n\nexport const authorCollectionJSONLD = (authors: AuthorRes) => {\n const jsonLD: WithContext<CollectionPage> = {\n \"@context\": \"https://schema.org\",\n \"@type\": \"CollectionPage\",\n name: \"Authors\",\n description: `Meet the authors of the ${opinlyConfig.siteName} blog`,\n url: `${opinlyConfig.blogUrl}/authors`,\n publisher: {\n \"@type\": \"Organization\",\n name: opinlyConfig.siteName,\n },\n mainEntity: authors.map((author) => ({\n \"@type\": \"Person\",\n name: author.name,\n url: `${opinlyConfig.blogUrl}/authors/${author.slug}`,\n image: author.image?.fileKey\n ? {\n \"@type\": \"ImageObject\",\n url: `${opinlyConfig.imagesUrl}/${author.image.fileKey}`,\n }\n : undefined,\n description: author.bio || undefined,\n })),\n };\n\n return JSON.stringify(jsonLD);\n};\n"],"mappings":"AAEA,SAAS,oBAAoB;AAOtB,MAAM,yBAAyB,CAAC,YAAuB;AAC5D,QAAM,SAAsC;AAAA,IAC1C,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,MAAM;AAAA,IACN,aAAa,2BAA2B,aAAa,QAAQ;AAAA,IAC7D,KAAK,GAAG,aAAa,OAAO;AAAA,IAC5B,WAAW;AAAA,MACT,SAAS;AAAA,MACT,MAAM,aAAa;AAAA,IACrB;AAAA,IACA,YAAY,QAAQ,IAAI,CAAC,YAAY;AAAA,MACnC,SAAS;AAAA,MACT,MAAM,OAAO;AAAA,MACb,KAAK,GAAG,aAAa,OAAO,YAAY,OAAO,IAAI;AAAA,MACnD,OAAO,OAAO,OAAO,UACjB;AAAA,QACE,SAAS;AAAA,QACT,KAAK,GAAG,aAAa,SAAS,IAAI,OAAO,MAAM,OAAO;AAAA,MACxD,IACA;AAAA,MACJ,aAAa,OAAO,OAAO;AAAA,IAC7B,EAAE;AAAA,EACJ;AAEA,SAAO,KAAK,UAAU,MAAM;AAC9B;","names":[]}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var authors_page_exports = {};
|
|
30
|
-
__export(authors_page_exports, {
|
|
31
|
-
AuthorsPage: () => AuthorsPage
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(authors_page_exports);
|
|
34
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
-
var import_image = __toESM(require("next/image"), 1);
|
|
36
|
-
var import_sdk_config = require("../../utils/sdk-config");
|
|
37
|
-
var import_post_preview = require("../post-preview");
|
|
38
|
-
var import_bread_crumbs = require("../bread-crumbs");
|
|
39
|
-
var import_link = __toESM(require("next/link"), 1);
|
|
40
|
-
var import_json_ld = require("../json-ld");
|
|
41
|
-
var import_json_ld2 = require("./_helpers/json-ld");
|
|
42
|
-
const AuthorsPage = ({
|
|
43
|
-
authors
|
|
44
|
-
}) => {
|
|
45
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
46
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_json_ld.OpinlyJSONLD, { content: (0, import_json_ld2.authorCollectionJSONLD)(authors) }),
|
|
47
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
48
|
-
import_json_ld.OpinlyBreadCrumbJsonLd,
|
|
49
|
-
{
|
|
50
|
-
items: [
|
|
51
|
-
{
|
|
52
|
-
slugNoPrefixSlash: "authors",
|
|
53
|
-
name: "Authors"
|
|
54
|
-
}
|
|
55
|
-
]
|
|
56
|
-
}
|
|
57
|
-
),
|
|
58
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "max-w-5xl mx-auto px-4 py-10", children: [
|
|
59
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
60
|
-
import_bread_crumbs.BreadCrumbs,
|
|
61
|
-
{
|
|
62
|
-
breadcrumbs: [
|
|
63
|
-
{
|
|
64
|
-
name: "Authors"
|
|
65
|
-
}
|
|
66
|
-
]
|
|
67
|
-
}
|
|
68
|
-
),
|
|
69
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { className: "text-3xl font-bold mb-10", children: "Authors" }),
|
|
70
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "space-y-16", children: authors.map((author, idx) => {
|
|
71
|
-
const authorSlug = `${import_sdk_config.opinlyConfig.blogPrefix}/authors/${author.slug}`;
|
|
72
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
73
|
-
"div",
|
|
74
|
-
{
|
|
75
|
-
className: "rounded-lg p-6 flex flex-col gap-6",
|
|
76
|
-
children: [
|
|
77
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-6 mb-4", children: [
|
|
78
|
-
author.image?.fileKey && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.default, { href: authorSlug, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
79
|
-
import_image.default,
|
|
80
|
-
{
|
|
81
|
-
src: `${import_sdk_config.opinlyConfig.imagesPrefix}/${author.image.fileKey}`,
|
|
82
|
-
alt: author.image.alt || author.name,
|
|
83
|
-
width: 100,
|
|
84
|
-
height: 100,
|
|
85
|
-
className: "rounded-full border"
|
|
86
|
-
}
|
|
87
|
-
) }),
|
|
88
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
89
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.default, { href: authorSlug, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "text-2xl font-semibold mb-1", children: author.name }) }),
|
|
90
|
-
author.bio && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-muted-foreground text-base max-w-2xl", children: author.bio })
|
|
91
|
-
] })
|
|
92
|
-
] }),
|
|
93
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
94
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 mb-4", children: author.posts && author.posts.length > 0 ? author.posts.map(
|
|
95
|
-
(post) => post && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_post_preview.PostPreview, { post }, post.slug)
|
|
96
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-muted-foreground col-span-full", children: "No posts yet." }) }),
|
|
97
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
98
|
-
import_link.default,
|
|
99
|
-
{
|
|
100
|
-
href: `${import_sdk_config.opinlyConfig.blogPrefix}/authors/${author.slug}`,
|
|
101
|
-
className: "text-bold",
|
|
102
|
-
children: [
|
|
103
|
-
"View more posts from ",
|
|
104
|
-
author.name
|
|
105
|
-
]
|
|
106
|
-
}
|
|
107
|
-
) })
|
|
108
|
-
] })
|
|
109
|
-
]
|
|
110
|
-
},
|
|
111
|
-
author.name + idx
|
|
112
|
-
);
|
|
113
|
-
}) })
|
|
114
|
-
] })
|
|
115
|
-
] });
|
|
116
|
-
};
|
|
117
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
118
|
-
0 && (module.exports = {
|
|
119
|
-
AuthorsPage
|
|
120
|
-
});
|
|
121
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/authors-page/index.tsx"],"sourcesContent":["import type { Opinly } from \"@opinly/backend\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../../utils/sdk-config\";\n\nimport { PostPreview } from \"../post-preview\";\nimport { BreadCrumbs } from \"../bread-crumbs\";\nimport Link from \"next/link\";\nimport { OpinlyBreadCrumbJsonLd, OpinlyJSONLD } from \"../json-ld\";\nimport { authorCollectionJSONLD } from \"./_helpers/json-ld\";\n\nexport const AuthorsPage = ({\n authors,\n}: {\n authors: Extract<\n Awaited<ReturnType<Opinly[\"content\"][\"blog\"]>>,\n { type: \"authors\" }\n >[\"data\"];\n}) => {\n return (\n <>\n <OpinlyJSONLD content={authorCollectionJSONLD(authors)} />\n <OpinlyBreadCrumbJsonLd\n items={[\n {\n slugNoPrefixSlash: \"authors\",\n name: \"Authors\",\n },\n ]}\n />\n <div className=\"max-w-5xl mx-auto px-4 py-10\">\n <BreadCrumbs\n breadcrumbs={[\n {\n name: \"Authors\",\n },\n ]}\n />\n <h1 className=\"text-3xl font-bold mb-10\">Authors</h1>\n <div className=\"space-y-16\">\n {authors.map((author, idx) => {\n const authorSlug = `${opinlyConfig.blogPrefix}/authors/${author.slug}`;\n\n return (\n <div\n key={author.name + idx}\n className=\"rounded-lg p-6 flex flex-col gap-6\"\n >\n <div className=\"flex items-center gap-6 mb-4\">\n {author.image?.fileKey && (\n <Link href={authorSlug}>\n <Image\n src={`${opinlyConfig.imagesPrefix}/${author.image.fileKey}`}\n alt={author.image.alt || author.name}\n width={100}\n height={100}\n className=\"rounded-full border\"\n />\n </Link>\n )}\n <div>\n <Link href={authorSlug}>\n <h2 className=\"text-2xl font-semibold mb-1\">\n {author.name}\n </h2>\n </Link>\n\n {author.bio && (\n <p className=\"text-muted-foreground text-base max-w-2xl\">\n {author.bio}\n </p>\n )}\n </div>\n </div>\n <div>\n <div className=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 mb-4\">\n {author.posts && author.posts.length > 0 ? (\n author.posts.map(\n (post) =>\n post && <PostPreview key={post.slug} post={post} />\n )\n ) : (\n <div className=\"text-muted-foreground col-span-full\">\n No posts yet.\n </div>\n )}\n </div>\n <div className=\"flex justify-end\">\n <Link\n href={`${opinlyConfig.blogPrefix}/authors/${author.slug}`}\n className=\"text-bold\"\n >\n View more posts from {author.name}\n </Link>\n </div>\n </div>\n </div>\n );\n })}\n </div>\n </div>\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmBI;AAlBJ,mBAAkB;AAClB,wBAA6B;AAE7B,0BAA4B;AAC5B,0BAA4B;AAC5B,kBAAiB;AACjB,qBAAqD;AACrD,IAAAA,kBAAuC;AAEhC,MAAM,cAAc,CAAC;AAAA,EAC1B;AACF,MAKM;AACJ,SACE,4EACE;AAAA,gDAAC,+BAAa,aAAS,wCAAuB,OAAO,GAAG;AAAA,IACxD;AAAA,MAAC;AAAA;AAAA,QACC,OAAO;AAAA,UACL;AAAA,YACE,mBAAmB;AAAA,YACnB,MAAM;AAAA,UACR;AAAA,QACF;AAAA;AAAA,IACF;AAAA,IACA,6CAAC,SAAI,WAAU,gCACb;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,aAAa;AAAA,YACX;AAAA,cACE,MAAM;AAAA,YACR;AAAA,UACF;AAAA;AAAA,MACF;AAAA,MACA,4CAAC,QAAG,WAAU,4BAA2B,qBAAO;AAAA,MAChD,4CAAC,SAAI,WAAU,cACZ,kBAAQ,IAAI,CAAC,QAAQ,QAAQ;AAC5B,cAAM,aAAa,GAAG,+BAAa,UAAU,YAAY,OAAO,IAAI;AAEpE,eACE;AAAA,UAAC;AAAA;AAAA,YAEC,WAAU;AAAA,YAEV;AAAA,2DAAC,SAAI,WAAU,gCACZ;AAAA,uBAAO,OAAO,WACb,4CAAC,YAAAC,SAAA,EAAK,MAAM,YACV;AAAA,kBAAC,aAAAC;AAAA,kBAAA;AAAA,oBACC,KAAK,GAAG,+BAAa,YAAY,IAAI,OAAO,MAAM,OAAO;AAAA,oBACzD,KAAK,OAAO,MAAM,OAAO,OAAO;AAAA,oBAChC,OAAO;AAAA,oBACP,QAAQ;AAAA,oBACR,WAAU;AAAA;AAAA,gBACZ,GACF;AAAA,gBAEF,6CAAC,SACC;AAAA,8DAAC,YAAAD,SAAA,EAAK,MAAM,YACV,sDAAC,QAAG,WAAU,+BACX,iBAAO,MACV,GACF;AAAA,kBAEC,OAAO,OACN,4CAAC,OAAE,WAAU,6CACV,iBAAO,KACV;AAAA,mBAEJ;AAAA,iBACF;AAAA,cACA,6CAAC,SACC;AAAA,4DAAC,SAAI,WAAU,6DACZ,iBAAO,SAAS,OAAO,MAAM,SAAS,IACrC,OAAO,MAAM;AAAA,kBACX,CAAC,SACC,QAAQ,4CAAC,mCAA4B,QAAX,KAAK,IAAkB;AAAA,gBACrD,IAEA,4CAAC,SAAI,WAAU,uCAAsC,2BAErD,GAEJ;AAAA,gBACA,4CAAC,SAAI,WAAU,oBACb;AAAA,kBAAC,YAAAA;AAAA,kBAAA;AAAA,oBACC,MAAM,GAAG,+BAAa,UAAU,YAAY,OAAO,IAAI;AAAA,oBACvD,WAAU;AAAA,oBACX;AAAA;AAAA,sBACuB,OAAO;AAAA;AAAA;AAAA,gBAC/B,GACF;AAAA,iBACF;AAAA;AAAA;AAAA,UAlDK,OAAO,OAAO;AAAA,QAmDrB;AAAA,MAEJ,CAAC,GACH;AAAA,OACF;AAAA,KACF;AAEJ;","names":["import_json_ld","Link","Image"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { Opinly } from '@opinly/backend';
|
|
3
|
-
|
|
4
|
-
declare const AuthorsPage: ({ authors, }: {
|
|
5
|
-
authors: Extract<Awaited<ReturnType<Opinly["content"]["blog"]>>, {
|
|
6
|
-
type: "authors";
|
|
7
|
-
}>["data"];
|
|
8
|
-
}) => react_jsx_runtime.JSX.Element;
|
|
9
|
-
|
|
10
|
-
export { AuthorsPage };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { Opinly } from '@opinly/backend';
|
|
3
|
-
|
|
4
|
-
declare const AuthorsPage: ({ authors, }: {
|
|
5
|
-
authors: Extract<Awaited<ReturnType<Opinly["content"]["blog"]>>, {
|
|
6
|
-
type: "authors";
|
|
7
|
-
}>["data"];
|
|
8
|
-
}) => react_jsx_runtime.JSX.Element;
|
|
9
|
-
|
|
10
|
-
export { AuthorsPage };
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import Image from "next/image";
|
|
3
|
-
import { opinlyConfig } from "../../utils/sdk-config";
|
|
4
|
-
import { PostPreview } from "../post-preview";
|
|
5
|
-
import { BreadCrumbs } from "../bread-crumbs";
|
|
6
|
-
import Link from "next/link";
|
|
7
|
-
import { OpinlyBreadCrumbJsonLd, OpinlyJSONLD } from "../json-ld";
|
|
8
|
-
import { authorCollectionJSONLD } from "./_helpers/json-ld";
|
|
9
|
-
const AuthorsPage = ({
|
|
10
|
-
authors
|
|
11
|
-
}) => {
|
|
12
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13
|
-
/* @__PURE__ */ jsx(OpinlyJSONLD, { content: authorCollectionJSONLD(authors) }),
|
|
14
|
-
/* @__PURE__ */ jsx(
|
|
15
|
-
OpinlyBreadCrumbJsonLd,
|
|
16
|
-
{
|
|
17
|
-
items: [
|
|
18
|
-
{
|
|
19
|
-
slugNoPrefixSlash: "authors",
|
|
20
|
-
name: "Authors"
|
|
21
|
-
}
|
|
22
|
-
]
|
|
23
|
-
}
|
|
24
|
-
),
|
|
25
|
-
/* @__PURE__ */ jsxs("div", { className: "max-w-5xl mx-auto px-4 py-10", children: [
|
|
26
|
-
/* @__PURE__ */ jsx(
|
|
27
|
-
BreadCrumbs,
|
|
28
|
-
{
|
|
29
|
-
breadcrumbs: [
|
|
30
|
-
{
|
|
31
|
-
name: "Authors"
|
|
32
|
-
}
|
|
33
|
-
]
|
|
34
|
-
}
|
|
35
|
-
),
|
|
36
|
-
/* @__PURE__ */ jsx("h1", { className: "text-3xl font-bold mb-10", children: "Authors" }),
|
|
37
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-16", children: authors.map((author, idx) => {
|
|
38
|
-
const authorSlug = `${opinlyConfig.blogPrefix}/authors/${author.slug}`;
|
|
39
|
-
return /* @__PURE__ */ jsxs(
|
|
40
|
-
"div",
|
|
41
|
-
{
|
|
42
|
-
className: "rounded-lg p-6 flex flex-col gap-6",
|
|
43
|
-
children: [
|
|
44
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-6 mb-4", children: [
|
|
45
|
-
author.image?.fileKey && /* @__PURE__ */ jsx(Link, { href: authorSlug, children: /* @__PURE__ */ jsx(
|
|
46
|
-
Image,
|
|
47
|
-
{
|
|
48
|
-
src: `${opinlyConfig.imagesPrefix}/${author.image.fileKey}`,
|
|
49
|
-
alt: author.image.alt || author.name,
|
|
50
|
-
width: 100,
|
|
51
|
-
height: 100,
|
|
52
|
-
className: "rounded-full border"
|
|
53
|
-
}
|
|
54
|
-
) }),
|
|
55
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
56
|
-
/* @__PURE__ */ jsx(Link, { href: authorSlug, children: /* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold mb-1", children: author.name }) }),
|
|
57
|
-
author.bio && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-base max-w-2xl", children: author.bio })
|
|
58
|
-
] })
|
|
59
|
-
] }),
|
|
60
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
61
|
-
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 mb-4", children: author.posts && author.posts.length > 0 ? author.posts.map(
|
|
62
|
-
(post) => post && /* @__PURE__ */ jsx(PostPreview, { post }, post.slug)
|
|
63
|
-
) : /* @__PURE__ */ jsx("div", { className: "text-muted-foreground col-span-full", children: "No posts yet." }) }),
|
|
64
|
-
/* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxs(
|
|
65
|
-
Link,
|
|
66
|
-
{
|
|
67
|
-
href: `${opinlyConfig.blogPrefix}/authors/${author.slug}`,
|
|
68
|
-
className: "text-bold",
|
|
69
|
-
children: [
|
|
70
|
-
"View more posts from ",
|
|
71
|
-
author.name
|
|
72
|
-
]
|
|
73
|
-
}
|
|
74
|
-
) })
|
|
75
|
-
] })
|
|
76
|
-
]
|
|
77
|
-
},
|
|
78
|
-
author.name + idx
|
|
79
|
-
);
|
|
80
|
-
}) })
|
|
81
|
-
] })
|
|
82
|
-
] });
|
|
83
|
-
};
|
|
84
|
-
export {
|
|
85
|
-
AuthorsPage
|
|
86
|
-
};
|
|
87
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/authors-page/index.tsx"],"sourcesContent":["import type { Opinly } from \"@opinly/backend\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../../utils/sdk-config\";\n\nimport { PostPreview } from \"../post-preview\";\nimport { BreadCrumbs } from \"../bread-crumbs\";\nimport Link from \"next/link\";\nimport { OpinlyBreadCrumbJsonLd, OpinlyJSONLD } from \"../json-ld\";\nimport { authorCollectionJSONLD } from \"./_helpers/json-ld\";\n\nexport const AuthorsPage = ({\n authors,\n}: {\n authors: Extract<\n Awaited<ReturnType<Opinly[\"content\"][\"blog\"]>>,\n { type: \"authors\" }\n >[\"data\"];\n}) => {\n return (\n <>\n <OpinlyJSONLD content={authorCollectionJSONLD(authors)} />\n <OpinlyBreadCrumbJsonLd\n items={[\n {\n slugNoPrefixSlash: \"authors\",\n name: \"Authors\",\n },\n ]}\n />\n <div className=\"max-w-5xl mx-auto px-4 py-10\">\n <BreadCrumbs\n breadcrumbs={[\n {\n name: \"Authors\",\n },\n ]}\n />\n <h1 className=\"text-3xl font-bold mb-10\">Authors</h1>\n <div className=\"space-y-16\">\n {authors.map((author, idx) => {\n const authorSlug = `${opinlyConfig.blogPrefix}/authors/${author.slug}`;\n\n return (\n <div\n key={author.name + idx}\n className=\"rounded-lg p-6 flex flex-col gap-6\"\n >\n <div className=\"flex items-center gap-6 mb-4\">\n {author.image?.fileKey && (\n <Link href={authorSlug}>\n <Image\n src={`${opinlyConfig.imagesPrefix}/${author.image.fileKey}`}\n alt={author.image.alt || author.name}\n width={100}\n height={100}\n className=\"rounded-full border\"\n />\n </Link>\n )}\n <div>\n <Link href={authorSlug}>\n <h2 className=\"text-2xl font-semibold mb-1\">\n {author.name}\n </h2>\n </Link>\n\n {author.bio && (\n <p className=\"text-muted-foreground text-base max-w-2xl\">\n {author.bio}\n </p>\n )}\n </div>\n </div>\n <div>\n <div className=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 mb-4\">\n {author.posts && author.posts.length > 0 ? (\n author.posts.map(\n (post) =>\n post && <PostPreview key={post.slug} post={post} />\n )\n ) : (\n <div className=\"text-muted-foreground col-span-full\">\n No posts yet.\n </div>\n )}\n </div>\n <div className=\"flex justify-end\">\n <Link\n href={`${opinlyConfig.blogPrefix}/authors/${author.slug}`}\n className=\"text-bold\"\n >\n View more posts from {author.name}\n </Link>\n </div>\n </div>\n </div>\n );\n })}\n </div>\n </div>\n </>\n );\n};\n"],"mappings":"AAmBI,mBACE,KAuCY,YAxCd;AAlBJ,OAAO,WAAW;AAClB,SAAS,oBAAoB;AAE7B,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,OAAO,UAAU;AACjB,SAAS,wBAAwB,oBAAoB;AACrD,SAAS,8BAA8B;AAEhC,MAAM,cAAc,CAAC;AAAA,EAC1B;AACF,MAKM;AACJ,SACE,iCACE;AAAA,wBAAC,gBAAa,SAAS,uBAAuB,OAAO,GAAG;AAAA,IACxD;AAAA,MAAC;AAAA;AAAA,QACC,OAAO;AAAA,UACL;AAAA,YACE,mBAAmB;AAAA,YACnB,MAAM;AAAA,UACR;AAAA,QACF;AAAA;AAAA,IACF;AAAA,IACA,qBAAC,SAAI,WAAU,gCACb;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,aAAa;AAAA,YACX;AAAA,cACE,MAAM;AAAA,YACR;AAAA,UACF;AAAA;AAAA,MACF;AAAA,MACA,oBAAC,QAAG,WAAU,4BAA2B,qBAAO;AAAA,MAChD,oBAAC,SAAI,WAAU,cACZ,kBAAQ,IAAI,CAAC,QAAQ,QAAQ;AAC5B,cAAM,aAAa,GAAG,aAAa,UAAU,YAAY,OAAO,IAAI;AAEpE,eACE;AAAA,UAAC;AAAA;AAAA,YAEC,WAAU;AAAA,YAEV;AAAA,mCAAC,SAAI,WAAU,gCACZ;AAAA,uBAAO,OAAO,WACb,oBAAC,QAAK,MAAM,YACV;AAAA,kBAAC;AAAA;AAAA,oBACC,KAAK,GAAG,aAAa,YAAY,IAAI,OAAO,MAAM,OAAO;AAAA,oBACzD,KAAK,OAAO,MAAM,OAAO,OAAO;AAAA,oBAChC,OAAO;AAAA,oBACP,QAAQ;AAAA,oBACR,WAAU;AAAA;AAAA,gBACZ,GACF;AAAA,gBAEF,qBAAC,SACC;AAAA,sCAAC,QAAK,MAAM,YACV,8BAAC,QAAG,WAAU,+BACX,iBAAO,MACV,GACF;AAAA,kBAEC,OAAO,OACN,oBAAC,OAAE,WAAU,6CACV,iBAAO,KACV;AAAA,mBAEJ;AAAA,iBACF;AAAA,cACA,qBAAC,SACC;AAAA,oCAAC,SAAI,WAAU,6DACZ,iBAAO,SAAS,OAAO,MAAM,SAAS,IACrC,OAAO,MAAM;AAAA,kBACX,CAAC,SACC,QAAQ,oBAAC,eAA4B,QAAX,KAAK,IAAkB;AAAA,gBACrD,IAEA,oBAAC,SAAI,WAAU,uCAAsC,2BAErD,GAEJ;AAAA,gBACA,oBAAC,SAAI,WAAU,oBACb;AAAA,kBAAC;AAAA;AAAA,oBACC,MAAM,GAAG,aAAa,UAAU,YAAY,OAAO,IAAI;AAAA,oBACvD,WAAU;AAAA,oBACX;AAAA;AAAA,sBACuB,OAAO;AAAA;AAAA;AAAA,gBAC/B,GACF;AAAA,iBACF;AAAA;AAAA;AAAA,UAlDK,OAAO,OAAO;AAAA,QAmDrB;AAAA,MAEJ,CAAC,GACH;AAAA,OACF;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var content_exports = {};
|
|
30
|
-
__export(content_exports, {
|
|
31
|
-
Content: () => Content
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(content_exports);
|
|
34
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
-
var import_merge = require("../../../utils/merge");
|
|
36
|
-
var import_link = __toESM(require("next/link"), 1);
|
|
37
|
-
var import_image = __toESM(require("next/image"), 1);
|
|
38
|
-
var import_sdk_config = require("../../../utils/sdk-config");
|
|
39
|
-
var import_react2 = __toESM(require("react"), 1);
|
|
40
|
-
function renderTiptapContent(content, classNames) {
|
|
41
|
-
if (!content?.content) return [];
|
|
42
|
-
return content.content.map((node, index) => {
|
|
43
|
-
switch (node.type) {
|
|
44
|
-
case "paragraph":
|
|
45
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: classNames.paragraph || "mb-4", children: renderChildren(node.content, classNames) }, index);
|
|
46
|
-
case "heading": {
|
|
47
|
-
const text = node.content?.[0]?.text ?? "";
|
|
48
|
-
const slug = text.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
49
|
-
const Tag = `h${node.attrs?.level || 1}`;
|
|
50
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
51
|
-
Tag,
|
|
52
|
-
{
|
|
53
|
-
id: slug,
|
|
54
|
-
className: classNames.heading || "mt-8 mb-4 font-bold text-op-heading",
|
|
55
|
-
children: renderChildren(node.content, classNames)
|
|
56
|
-
},
|
|
57
|
-
index
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
case "image":
|
|
61
|
-
const fileKey = node.attrs?.fileKey;
|
|
62
|
-
if (!fileKey) {
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
66
|
-
"div",
|
|
67
|
-
{
|
|
68
|
-
className: (0, import_merge.cn)(
|
|
69
|
-
"w-full max-w-[800px] my-10 rounded-lg overflow-hidden flex items-center justify-center",
|
|
70
|
-
classNames.image
|
|
71
|
-
),
|
|
72
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
73
|
-
import_image.default,
|
|
74
|
-
{
|
|
75
|
-
unoptimized: import_sdk_config.opinlyConfig.unoptimizedImages,
|
|
76
|
-
src: `${import_sdk_config.opinlyConfig.imagesPrefix}/${fileKey}`,
|
|
77
|
-
title: node.attrs?.title || "",
|
|
78
|
-
alt: node.attrs?.alt || "",
|
|
79
|
-
width: 800,
|
|
80
|
-
height: 400,
|
|
81
|
-
className: "rounded-lg max-w-full max-h-full"
|
|
82
|
-
}
|
|
83
|
-
)
|
|
84
|
-
},
|
|
85
|
-
index
|
|
86
|
-
);
|
|
87
|
-
case "bulletList":
|
|
88
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
89
|
-
"ul",
|
|
90
|
-
{
|
|
91
|
-
className: (0, import_merge.cn)("list-disc pl-6 my-4", classNames.bulletList),
|
|
92
|
-
children: renderTiptapContent(node, classNames)
|
|
93
|
-
},
|
|
94
|
-
index
|
|
95
|
-
);
|
|
96
|
-
case "orderedList":
|
|
97
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
98
|
-
"ol",
|
|
99
|
-
{
|
|
100
|
-
className: (0, import_merge.cn)("list-decimal pl-6 my-4", classNames.orderedList),
|
|
101
|
-
children: renderTiptapContent(node, classNames)
|
|
102
|
-
},
|
|
103
|
-
index
|
|
104
|
-
);
|
|
105
|
-
case "listItem":
|
|
106
|
-
if (node.content && node.content.length === 1 && node.content[0].type === "paragraph") {
|
|
107
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: (0, import_merge.cn)("my-1", classNames.listItem), children: renderChildren(node.content[0].content, classNames) }, index);
|
|
108
|
-
}
|
|
109
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: (0, import_merge.cn)("my-1", classNames.listItem), children: renderChildren(node.content, classNames) }, index);
|
|
110
|
-
default:
|
|
111
|
-
return null;
|
|
112
|
-
}
|
|
113
|
-
}).filter(Boolean);
|
|
114
|
-
}
|
|
115
|
-
const Content = ({
|
|
116
|
-
content,
|
|
117
|
-
classNames
|
|
118
|
-
}) => {
|
|
119
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "prose min-w-full", children: renderTiptapContent(content, classNames) });
|
|
120
|
-
};
|
|
121
|
-
function renderChildren(nodes, classNames) {
|
|
122
|
-
if (!nodes) {
|
|
123
|
-
return [];
|
|
124
|
-
}
|
|
125
|
-
return nodes.map((child, idx) => {
|
|
126
|
-
if (child.type === "text") {
|
|
127
|
-
let text = child.text;
|
|
128
|
-
if (child.marks) {
|
|
129
|
-
child.marks.forEach((mark) => {
|
|
130
|
-
if (mark.type === "bold") text = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: text }, idx);
|
|
131
|
-
if (mark.type === "italic") text = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("em", { children: text }, idx);
|
|
132
|
-
if (mark.type === "link")
|
|
133
|
-
text = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
134
|
-
import_link.default,
|
|
135
|
-
{
|
|
136
|
-
href: mark.attrs?.href,
|
|
137
|
-
className: classNames.link || "text-blue-600 underline",
|
|
138
|
-
children: text
|
|
139
|
-
},
|
|
140
|
-
idx
|
|
141
|
-
);
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: text }, idx);
|
|
145
|
-
} else {
|
|
146
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react2.default.Fragment, { children: renderTiptapContent(
|
|
147
|
-
{ ...child, content: child.content },
|
|
148
|
-
classNames
|
|
149
|
-
) }, idx);
|
|
150
|
-
}
|
|
151
|
-
}).filter(Boolean);
|
|
152
|
-
}
|
|
153
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
154
|
-
0 && (module.exports = {
|
|
155
|
-
Content
|
|
156
|
-
});
|
|
157
|
-
//# sourceMappingURL=content.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/blog-post/_components/content.tsx"],"sourcesContent":["import type { JSONContent } from \"@tiptap/core\";\nimport { BlogComponentClassNames } from \"../_types/class-names\";\nimport { cn } from \"../../../utils/merge\";\nimport Link from \"next/link\";\nimport { JSX } from \"react\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../../../utils/sdk-config\";\nimport React from \"react\";\n\nfunction renderTiptapContent(\n content: JSONContent,\n classNames: BlogComponentClassNames\n): React.ReactNode[] {\n if (!content?.content) return [];\n\n return content.content\n .map((node, index) => {\n switch (node.type) {\n case \"paragraph\":\n return (\n <p key={index} className={classNames.paragraph || \"mb-4\"}>\n {renderChildren(node.content, classNames)}\n </p>\n );\n case \"heading\": {\n const text = node.content?.[0]?.text ?? \"\";\n const slug = text\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n const Tag = `h${\n node.attrs?.level || 1\n }` as keyof JSX.IntrinsicElements;\n return (\n <Tag\n key={index}\n id={slug}\n className={\n classNames.heading || \"mt-8 mb-4 font-bold text-op-heading\"\n }\n >\n {renderChildren(node.content, classNames)}\n </Tag>\n );\n }\n case \"image\":\n const fileKey = node.attrs?.fileKey;\n\n if (!fileKey) {\n return null;\n }\n\n return (\n <div\n key={index}\n className={cn(\n \"w-full max-w-[800px] my-10 rounded-lg overflow-hidden flex items-center justify-center\",\n classNames.image\n )}\n >\n <Image\n unoptimized={opinlyConfig.unoptimizedImages}\n src={`${opinlyConfig.imagesPrefix}/${fileKey}`}\n title={node.attrs?.title || \"\"}\n alt={node.attrs?.alt || \"\"}\n width={800}\n height={400}\n className=\"rounded-lg max-w-full max-h-full\"\n />\n </div>\n );\n case \"bulletList\":\n return (\n <ul\n key={index}\n className={cn(\"list-disc pl-6 my-4\", classNames.bulletList)}\n >\n {renderTiptapContent(node, classNames)}\n </ul>\n );\n case \"orderedList\":\n return (\n <ol\n key={index}\n className={cn(\"list-decimal pl-6 my-4\", classNames.orderedList)}\n >\n {renderTiptapContent(node, classNames)}\n </ol>\n );\n case \"listItem\":\n if (\n node.content &&\n node.content.length === 1 &&\n node.content[0].type === \"paragraph\"\n ) {\n return (\n <li key={index} className={cn(\"my-1\", classNames.listItem)}>\n {renderChildren(node.content[0].content, classNames)}\n </li>\n );\n }\n return (\n <li key={index} className={cn(\"my-1\", classNames.listItem)}>\n {renderChildren(node.content, classNames)}\n </li>\n );\n default:\n return null;\n }\n })\n .filter(Boolean);\n}\n\nexport const Content = ({\n content,\n classNames,\n}: {\n content: JSONContent;\n classNames: BlogComponentClassNames;\n}) => {\n return (\n <div className=\"prose min-w-full\">\n {renderTiptapContent(content, classNames)}\n </div>\n );\n};\n\nfunction renderChildren(\n nodes: JSONContent[\"content\"] | undefined,\n classNames: BlogComponentClassNames\n): JSX.Element[] {\n if (!nodes) {\n return [];\n }\n\n return nodes\n .map((child, idx) => {\n if (child.type === \"text\") {\n let text: React.ReactNode = child.text;\n if (child.marks) {\n child.marks.forEach((mark) => {\n if (mark.type === \"bold\") text = <strong key={idx}>{text}</strong>;\n if (mark.type === \"italic\") text = <em key={idx}>{text}</em>;\n if (mark.type === \"link\")\n text = (\n <Link\n key={idx}\n href={mark.attrs?.href}\n className={classNames.link || \"text-blue-600 underline\"}\n >\n {text}\n </Link>\n );\n });\n }\n return <span key={idx}>{text}</span>;\n } else {\n // Recursively render non-text nodes (e.g., paragraph, listItem, etc.)\n return (\n <React.Fragment key={idx}>\n {renderTiptapContent(\n { ...child, content: child.content },\n classNames\n )}\n </React.Fragment>\n );\n }\n })\n .filter(Boolean) as JSX.Element[];\n}\n"],"mappings":"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","names":["import_react","Image","Link","React"]}
|