@opinly/next 0.1.6 → 0.1.7
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/components/author-page/_helpers/json-ld.cjs +2 -0
- package/dist/components/author-page/_helpers/json-ld.cjs.map +1 -0
- package/dist/components/author-page/_helpers/json-ld.d.cts +2 -0
- package/dist/components/author-page/_helpers/json-ld.d.ts +2 -0
- package/dist/components/author-page/_helpers/json-ld.js +1 -0
- package/dist/components/author-page/_helpers/json-ld.js.map +1 -0
- package/dist/components/author-page/index.cjs +84 -0
- package/dist/components/author-page/index.cjs.map +1 -0
- package/dist/components/author-page/index.d.cts +10 -0
- package/dist/components/author-page/index.d.ts +10 -0
- package/dist/components/author-page/index.js +50 -0
- package/dist/components/author-page/index.js.map +1 -0
- package/dist/components/authors-page/index.cjs +106 -0
- package/dist/components/authors-page/index.cjs.map +1 -0
- package/dist/components/authors-page/index.d.cts +10 -0
- package/dist/components/authors-page/index.d.ts +10 -0
- package/dist/components/authors-page/index.js +72 -0
- package/dist/components/authors-page/index.js.map +1 -0
- package/dist/components/blog-post/_components/content.cjs +130 -0
- package/dist/components/blog-post/_components/content.cjs.map +1 -0
- package/dist/components/blog-post/_components/content.d.cts +10 -0
- package/dist/components/blog-post/_components/content.d.ts +10 -0
- package/dist/components/blog-post/_components/content.js +96 -0
- package/dist/components/blog-post/_components/content.js.map +1 -0
- package/dist/components/blog-post/_components/faq.cjs +39 -0
- package/dist/components/blog-post/_components/faq.cjs.map +1 -0
- package/dist/components/blog-post/_components/faq.d.cts +9 -0
- package/dist/components/blog-post/_components/faq.d.ts +9 -0
- package/dist/components/blog-post/_components/faq.js +15 -0
- package/dist/components/blog-post/_components/faq.js.map +1 -0
- package/dist/components/blog-post/_components/share.cjs +100 -0
- package/dist/components/blog-post/_components/share.cjs.map +1 -0
- package/dist/components/blog-post/_components/share.d.cts +9 -0
- package/dist/components/blog-post/_components/share.d.ts +9 -0
- package/dist/components/blog-post/_components/share.js +66 -0
- package/dist/components/blog-post/_components/share.js.map +1 -0
- package/dist/components/blog-post/_components/table-of-contents.cjs +82 -0
- package/dist/components/blog-post/_components/table-of-contents.cjs.map +1 -0
- package/dist/components/blog-post/_components/table-of-contents.d.cts +13 -0
- package/dist/components/blog-post/_components/table-of-contents.d.ts +13 -0
- package/dist/components/blog-post/_components/table-of-contents.js +48 -0
- package/dist/components/blog-post/_components/table-of-contents.js.map +1 -0
- package/dist/components/blog-post/_helpers/calc-reading-time.cjs +2 -0
- package/dist/components/blog-post/_helpers/calc-reading-time.cjs.map +1 -0
- package/dist/components/blog-post/_helpers/calc-reading-time.d.cts +2 -0
- package/dist/components/blog-post/_helpers/calc-reading-time.d.ts +2 -0
- package/dist/components/blog-post/_helpers/calc-reading-time.js +1 -0
- package/dist/components/blog-post/_helpers/calc-reading-time.js.map +1 -0
- package/dist/components/blog-post/_helpers/extract-headings.cjs +44 -0
- package/dist/components/blog-post/_helpers/extract-headings.cjs.map +1 -0
- package/dist/components/blog-post/_helpers/extract-headings.d.cts +8 -0
- package/dist/components/blog-post/_helpers/extract-headings.d.ts +8 -0
- package/dist/components/blog-post/_helpers/extract-headings.js +20 -0
- package/dist/components/blog-post/_helpers/extract-headings.js.map +1 -0
- package/dist/components/blog-post/_helpers/json-ld.cjs +170 -0
- package/dist/components/blog-post/_helpers/json-ld.cjs.map +1 -0
- package/dist/components/blog-post/_helpers/json-ld.d.cts +11 -0
- package/dist/components/blog-post/_helpers/json-ld.d.ts +11 -0
- package/dist/components/blog-post/_helpers/json-ld.js +143 -0
- package/dist/components/blog-post/_helpers/json-ld.js.map +1 -0
- package/dist/components/blog-post/_helpers/reading-time.cjs +50 -0
- package/dist/components/blog-post/_helpers/reading-time.cjs.map +1 -0
- package/dist/components/blog-post/_helpers/reading-time.d.cts +6 -0
- package/dist/components/blog-post/_helpers/reading-time.d.ts +6 -0
- package/dist/components/blog-post/_helpers/reading-time.js +25 -0
- package/dist/components/blog-post/_helpers/reading-time.js.map +1 -0
- package/dist/components/blog-post/_types/blog-post.cjs +17 -0
- package/dist/components/blog-post/_types/blog-post.cjs.map +1 -0
- package/dist/components/blog-post/_types/blog-post.d.cts +7 -0
- package/dist/components/blog-post/_types/blog-post.d.ts +7 -0
- package/dist/components/blog-post/_types/blog-post.js +1 -0
- package/dist/components/blog-post/_types/blog-post.js.map +1 -0
- package/dist/components/blog-post/_types/class-names.cjs +17 -0
- package/dist/components/blog-post/_types/class-names.cjs.map +1 -0
- package/dist/components/blog-post/_types/class-names.d.cts +12 -0
- package/dist/components/blog-post/_types/class-names.d.ts +12 -0
- package/dist/components/blog-post/_types/class-names.js +1 -0
- package/dist/components/blog-post/_types/class-names.js.map +1 -0
- package/dist/components/blog-post/index.cjs +149 -0
- package/dist/components/blog-post/index.cjs.map +1 -0
- package/dist/components/blog-post/index.d.cts +13 -0
- package/dist/components/blog-post/index.d.ts +13 -0
- package/dist/components/blog-post/index.js +119 -0
- package/dist/components/blog-post/index.js.map +1 -0
- package/dist/components/bread-crumbs.cjs +60 -0
- package/dist/components/bread-crumbs.cjs.map +1 -0
- package/dist/components/bread-crumbs.d.cts +10 -0
- package/dist/components/bread-crumbs.d.ts +10 -0
- package/dist/components/bread-crumbs.js +26 -0
- package/dist/components/bread-crumbs.js.map +1 -0
- package/dist/components/folder-page/index.cjs +61 -0
- package/dist/components/folder-page/index.cjs.map +1 -0
- package/dist/components/folder-page/index.d.cts +10 -0
- package/dist/components/folder-page/index.d.ts +10 -0
- package/dist/components/folder-page/index.js +37 -0
- package/dist/components/folder-page/index.js.map +1 -0
- package/dist/components/home-page.cjs +71 -0
- package/dist/components/home-page.cjs.map +1 -0
- package/dist/components/home-page.d.cts +12 -0
- package/dist/components/home-page.d.ts +12 -0
- package/dist/components/home-page.js +37 -0
- package/dist/components/home-page.js.map +1 -0
- package/dist/components/not-found.cjs +60 -0
- package/dist/components/not-found.cjs.map +1 -0
- package/dist/components/not-found.d.cts +5 -0
- package/dist/components/not-found.d.ts +5 -0
- package/dist/components/not-found.js +26 -0
- package/dist/components/not-found.js.map +1 -0
- package/dist/components/opinly-blog.cjs +56 -0
- package/dist/components/opinly-blog.cjs.map +1 -0
- package/dist/components/opinly-blog.d.cts +9 -0
- package/dist/components/opinly-blog.d.ts +9 -0
- package/dist/components/opinly-blog.js +32 -0
- package/dist/components/opinly-blog.js.map +1 -0
- package/dist/components/post-preview.cjs +93 -0
- package/dist/components/post-preview.cjs.map +1 -0
- package/dist/components/post-preview.d.cts +10 -0
- package/dist/components/post-preview.d.ts +10 -0
- package/dist/components/post-preview.js +59 -0
- package/dist/components/post-preview.js.map +1 -0
- package/dist/index.d.cts +4 -17
- package/dist/index.d.ts +4 -17
- package/package.json +21 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=json-ld.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,84 @@
|
|
|
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 author_page_exports = {};
|
|
30
|
+
__export(author_page_exports, {
|
|
31
|
+
AuthorPage: () => AuthorPage
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(author_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("../../sdk-config");
|
|
37
|
+
var import_images = require("../../utils/images");
|
|
38
|
+
var import_post_preview = require("../post-preview");
|
|
39
|
+
var import_bread_crumbs = require("../bread-crumbs");
|
|
40
|
+
const AuthorPage = ({
|
|
41
|
+
author
|
|
42
|
+
}) => {
|
|
43
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "max-w-5xl mx-auto px-4 py-10", children: [
|
|
44
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
45
|
+
import_bread_crumbs.BreadCrumbs,
|
|
46
|
+
{
|
|
47
|
+
breadcrumbs: [
|
|
48
|
+
{
|
|
49
|
+
name: "Authors",
|
|
50
|
+
url: `${import_sdk_config.opinlyConfig.blogPrefix}/authors`
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-6 mb-10", children: [
|
|
56
|
+
author.image.fileKey && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
57
|
+
import_image.default,
|
|
58
|
+
{
|
|
59
|
+
src: `${import_sdk_config.opinlyConfig.imagesPrefix}/${(0, import_images.replaceImageNameSpace)(author.image.fileKey)}`,
|
|
60
|
+
alt: author.image.alt || author.name,
|
|
61
|
+
width: 150,
|
|
62
|
+
height: 150,
|
|
63
|
+
className: "rounded-full border"
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
67
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { className: "text-3xl font-bold mb-1", children: author.name }),
|
|
68
|
+
author.bio && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-muted-foreground text-base max-w-2xl", children: author.bio })
|
|
69
|
+
] })
|
|
70
|
+
] }),
|
|
71
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h2", { className: "text-xl font-semibold mb-6", children: [
|
|
72
|
+
"Posts by ",
|
|
73
|
+
author.name
|
|
74
|
+
] }),
|
|
75
|
+
/* @__PURE__ */ (0, import_jsx_runtime.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(
|
|
76
|
+
(post) => post && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_post_preview.PostPreview, { post }, post.slug)
|
|
77
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-muted-foreground col-span-full", children: "No posts yet." }) })
|
|
78
|
+
] });
|
|
79
|
+
};
|
|
80
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
81
|
+
0 && (module.exports = {
|
|
82
|
+
AuthorPage
|
|
83
|
+
});
|
|
84
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/author-page/index.tsx"],"sourcesContent":["import { Opinly } from \"@opinly/backend\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../../sdk-config\";\nimport { replaceImageNameSpace } from \"../../utils/images\";\nimport { PostPreview } from \"../post-preview\";\nimport { BreadCrumbs } from \"../bread-crumbs\";\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 <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 src={`${opinlyConfig.imagesPrefix}/${replaceImageNameSpace(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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBM;AAhBN,mBAAkB;AAClB,wBAA6B;AAC7B,oBAAsC;AACtC,0BAA4B;AAC5B,0BAA4B;AAErB,MAAM,aAAa,CAAC;AAAA,EACzB;AACF,MAKM;AACJ,SACE,6CAAC,SAAI,WAAU,gCACb;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,aAAa;AAAA,UACX;AAAA,YACE,MAAM;AAAA,YACN,KAAK,GAAG,+BAAa,UAAU;AAAA,UACjC;AAAA,QACF;AAAA;AAAA,IACF;AAAA,IAEA,6CAAC,SAAI,WAAU,iCACZ;AAAA,aAAO,MAAM,WACZ;AAAA,QAAC,aAAAA;AAAA,QAAA;AAAA,UACC,KAAK,GAAG,+BAAa,YAAY,QAAI,qCAAsB,OAAO,MAAM,OAAO,CAAC;AAAA,UAChF,KAAK,OAAO,MAAM,OAAO,OAAO;AAAA,UAChC,OAAO;AAAA,UACP,QAAQ;AAAA,UACR,WAAU;AAAA;AAAA,MACZ;AAAA,MAEF,6CAAC,SACC;AAAA,oDAAC,QAAG,WAAU,2BAA2B,iBAAO,MAAK;AAAA,QACpD,OAAO,OACN,4CAAC,OAAE,WAAU,6CACV,iBAAO,KACV;AAAA,SAEJ;AAAA,OACF;AAAA,IAGA,6CAAC,QAAG,WAAU,8BAA6B;AAAA;AAAA,MAAU,OAAO;AAAA,OAAK;AAAA,IACjE,4CAAC,SAAI,WAAU,wDACZ,iBAAO,SAAS,OAAO,MAAM,SAAS,IACrC,OAAO,MAAM;AAAA,MACX,CAAC,SAAS,QAAQ,4CAAC,mCAA4B,QAAX,KAAK,IAAkB;AAAA,IAC7D,IAEA,4CAAC,SAAI,WAAU,uCAAsC,2BAErD,GAEJ;AAAA,KACF;AAEJ;","names":["Image"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Opinly } from '@opinly/backend';
|
|
3
|
+
|
|
4
|
+
declare const AuthorPage: ({ author, }: {
|
|
5
|
+
author: Extract<Awaited<ReturnType<Opinly["content"]["blog"]>>, {
|
|
6
|
+
type: "author";
|
|
7
|
+
}>["data"];
|
|
8
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { AuthorPage };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Opinly } from '@opinly/backend';
|
|
3
|
+
|
|
4
|
+
declare const AuthorPage: ({ author, }: {
|
|
5
|
+
author: Extract<Awaited<ReturnType<Opinly["content"]["blog"]>>, {
|
|
6
|
+
type: "author";
|
|
7
|
+
}>["data"];
|
|
8
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { AuthorPage };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Image from "next/image";
|
|
3
|
+
import { opinlyConfig } from "../../sdk-config";
|
|
4
|
+
import { replaceImageNameSpace } from "../../utils/images";
|
|
5
|
+
import { PostPreview } from "../post-preview";
|
|
6
|
+
import { BreadCrumbs } from "../bread-crumbs";
|
|
7
|
+
const AuthorPage = ({
|
|
8
|
+
author
|
|
9
|
+
}) => {
|
|
10
|
+
return /* @__PURE__ */ jsxs("div", { className: "max-w-5xl mx-auto px-4 py-10", children: [
|
|
11
|
+
/* @__PURE__ */ jsx(
|
|
12
|
+
BreadCrumbs,
|
|
13
|
+
{
|
|
14
|
+
breadcrumbs: [
|
|
15
|
+
{
|
|
16
|
+
name: "Authors",
|
|
17
|
+
url: `${opinlyConfig.blogPrefix}/authors`
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
),
|
|
22
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-6 mb-10", children: [
|
|
23
|
+
author.image.fileKey && /* @__PURE__ */ jsx(
|
|
24
|
+
Image,
|
|
25
|
+
{
|
|
26
|
+
src: `${opinlyConfig.imagesPrefix}/${replaceImageNameSpace(author.image.fileKey)}`,
|
|
27
|
+
alt: author.image.alt || author.name,
|
|
28
|
+
width: 150,
|
|
29
|
+
height: 150,
|
|
30
|
+
className: "rounded-full border"
|
|
31
|
+
}
|
|
32
|
+
),
|
|
33
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
34
|
+
/* @__PURE__ */ jsx("h1", { className: "text-3xl font-bold mb-1", children: author.name }),
|
|
35
|
+
author.bio && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-base max-w-2xl", children: author.bio })
|
|
36
|
+
] })
|
|
37
|
+
] }),
|
|
38
|
+
/* @__PURE__ */ jsxs("h2", { className: "text-xl font-semibold mb-6", children: [
|
|
39
|
+
"Posts by ",
|
|
40
|
+
author.name
|
|
41
|
+
] }),
|
|
42
|
+
/* @__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(
|
|
43
|
+
(post) => post && /* @__PURE__ */ jsx(PostPreview, { post }, post.slug)
|
|
44
|
+
) : /* @__PURE__ */ jsx("div", { className: "text-muted-foreground col-span-full", children: "No posts yet." }) })
|
|
45
|
+
] });
|
|
46
|
+
};
|
|
47
|
+
export {
|
|
48
|
+
AuthorPage
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/author-page/index.tsx"],"sourcesContent":["import { Opinly } from \"@opinly/backend\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../../sdk-config\";\nimport { replaceImageNameSpace } from \"../../utils/images\";\nimport { PostPreview } from \"../post-preview\";\nimport { BreadCrumbs } from \"../bread-crumbs\";\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 <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 src={`${opinlyConfig.imagesPrefix}/${replaceImageNameSpace(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"],"mappings":"AAiBM,cAmBE,YAnBF;AAhBN,OAAO,WAAW;AAClB,SAAS,oBAAoB;AAC7B,SAAS,6BAA6B;AACtC,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAErB,MAAM,aAAa,CAAC;AAAA,EACzB;AACF,MAKM;AACJ,SACE,qBAAC,SAAI,WAAU,gCACb;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,aAAa;AAAA,UACX;AAAA,YACE,MAAM;AAAA,YACN,KAAK,GAAG,aAAa,UAAU;AAAA,UACjC;AAAA,QACF;AAAA;AAAA,IACF;AAAA,IAEA,qBAAC,SAAI,WAAU,iCACZ;AAAA,aAAO,MAAM,WACZ;AAAA,QAAC;AAAA;AAAA,UACC,KAAK,GAAG,aAAa,YAAY,IAAI,sBAAsB,OAAO,MAAM,OAAO,CAAC;AAAA,UAChF,KAAK,OAAO,MAAM,OAAO,OAAO;AAAA,UAChC,OAAO;AAAA,UACP,QAAQ;AAAA,UACR,WAAU;AAAA;AAAA,MACZ;AAAA,MAEF,qBAAC,SACC;AAAA,4BAAC,QAAG,WAAU,2BAA2B,iBAAO,MAAK;AAAA,QACpD,OAAO,OACN,oBAAC,OAAE,WAAU,6CACV,iBAAO,KACV;AAAA,SAEJ;AAAA,OACF;AAAA,IAGA,qBAAC,QAAG,WAAU,8BAA6B;AAAA;AAAA,MAAU,OAAO;AAAA,OAAK;AAAA,IACjE,oBAAC,SAAI,WAAU,wDACZ,iBAAO,SAAS,OAAO,MAAM,SAAS,IACrC,OAAO,MAAM;AAAA,MACX,CAAC,SAAS,QAAQ,oBAAC,eAA4B,QAAX,KAAK,IAAkB;AAAA,IAC7D,IAEA,oBAAC,SAAI,WAAU,uCAAsC,2BAErD,GAEJ;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,106 @@
|
|
|
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("../../sdk-config");
|
|
37
|
+
var import_images = require("../../utils/images");
|
|
38
|
+
var import_post_preview = require("../post-preview");
|
|
39
|
+
var import_bread_crumbs = require("../bread-crumbs");
|
|
40
|
+
var import_link = __toESM(require("next/link"), 1);
|
|
41
|
+
const AuthorsPage = ({
|
|
42
|
+
authors
|
|
43
|
+
}) => {
|
|
44
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "max-w-5xl mx-auto px-4 py-10", children: [
|
|
45
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
46
|
+
import_bread_crumbs.BreadCrumbs,
|
|
47
|
+
{
|
|
48
|
+
breadcrumbs: [
|
|
49
|
+
{
|
|
50
|
+
name: "Authors"
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { className: "text-3xl font-bold mb-10", children: "Authors" }),
|
|
56
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "space-y-16", children: authors.map((author, idx) => {
|
|
57
|
+
const authorSlug = `${import_sdk_config.opinlyConfig.blogPrefix}/authors/${author.slug}`;
|
|
58
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
className: "rounded-lg p-6 flex flex-col gap-6",
|
|
62
|
+
children: [
|
|
63
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-6 mb-4", children: [
|
|
64
|
+
author.image?.fileKey && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.default, { href: authorSlug, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
65
|
+
import_image.default,
|
|
66
|
+
{
|
|
67
|
+
src: `${import_sdk_config.opinlyConfig.imagesPrefix}/${(0, import_images.replaceImageNameSpace)(author.image.fileKey)}`,
|
|
68
|
+
alt: author.image.alt || author.name,
|
|
69
|
+
width: 100,
|
|
70
|
+
height: 100,
|
|
71
|
+
className: "rounded-full border"
|
|
72
|
+
}
|
|
73
|
+
) }),
|
|
74
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
75
|
+
/* @__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 }) }),
|
|
76
|
+
author.bio && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-muted-foreground text-base max-w-2xl", children: author.bio })
|
|
77
|
+
] })
|
|
78
|
+
] }),
|
|
79
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
80
|
+
/* @__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(
|
|
81
|
+
(post) => post && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_post_preview.PostPreview, { post }, post.slug)
|
|
82
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-muted-foreground col-span-full", children: "No posts yet." }) }),
|
|
83
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
84
|
+
import_link.default,
|
|
85
|
+
{
|
|
86
|
+
href: `${import_sdk_config.opinlyConfig.blogPrefix}/authors/${author.slug}`,
|
|
87
|
+
className: "text-bold",
|
|
88
|
+
children: [
|
|
89
|
+
"View more posts from ",
|
|
90
|
+
author.name
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
) })
|
|
94
|
+
] })
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
author.name + idx
|
|
98
|
+
);
|
|
99
|
+
}) })
|
|
100
|
+
] });
|
|
101
|
+
};
|
|
102
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
103
|
+
0 && (module.exports = {
|
|
104
|
+
AuthorsPage
|
|
105
|
+
});
|
|
106
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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 \"../../sdk-config\";\nimport { replaceImageNameSpace } from \"../../utils/images\";\nimport { PostPreview } from \"../post-preview\";\nimport { BreadCrumbs } from \"../bread-crumbs\";\nimport Link from \"next/link\";\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 <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}/${replaceImageNameSpace(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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBM;AAjBN,mBAAkB;AAClB,wBAA6B;AAC7B,oBAAsC;AACtC,0BAA4B;AAC5B,0BAA4B;AAC5B,kBAAiB;AAEV,MAAM,cAAc,CAAC;AAAA,EAC1B;AACF,MAKM;AACJ,SACE,6CAAC,SAAI,WAAU,gCACb;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,aAAa;AAAA,UACX;AAAA,YACE,MAAM;AAAA,UACR;AAAA,QACF;AAAA;AAAA,IACF;AAAA,IACA,4CAAC,QAAG,WAAU,4BAA2B,qBAAO;AAAA,IAChD,4CAAC,SAAI,WAAU,cACZ,kBAAQ,IAAI,CAAC,QAAQ,QAAQ;AAC5B,YAAM,aAAa,GAAG,+BAAa,UAAU,YAAY,OAAO,IAAI;AAEpE,aACE;AAAA,QAAC;AAAA;AAAA,UAEC,WAAU;AAAA,UAEV;AAAA,yDAAC,SAAI,WAAU,gCACZ;AAAA,qBAAO,OAAO,WACb,4CAAC,YAAAA,SAAA,EAAK,MAAM,YACV;AAAA,gBAAC,aAAAC;AAAA,gBAAA;AAAA,kBACC,KAAK,GAAG,+BAAa,YAAY,QAAI,qCAAsB,OAAO,MAAM,OAAO,CAAC;AAAA,kBAChF,KAAK,OAAO,MAAM,OAAO,OAAO;AAAA,kBAChC,OAAO;AAAA,kBACP,QAAQ;AAAA,kBACR,WAAU;AAAA;AAAA,cACZ,GACF;AAAA,cAEF,6CAAC,SACC;AAAA,4DAAC,YAAAD,SAAA,EAAK,MAAM,YACV,sDAAC,QAAG,WAAU,+BACX,iBAAO,MACV,GACF;AAAA,gBAEC,OAAO,OACN,4CAAC,OAAE,WAAU,6CACV,iBAAO,KACV;AAAA,iBAEJ;AAAA,eACF;AAAA,YACA,6CAAC,SACC;AAAA,0DAAC,SAAI,WAAU,6DACZ,iBAAO,SAAS,OAAO,MAAM,SAAS,IACrC,OAAO,MAAM;AAAA,gBACX,CAAC,SACC,QAAQ,4CAAC,mCAA4B,QAAX,KAAK,IAAkB;AAAA,cACrD,IAEA,4CAAC,SAAI,WAAU,uCAAsC,2BAErD,GAEJ;AAAA,cACA,4CAAC,SAAI,WAAU,oBACb;AAAA,gBAAC,YAAAA;AAAA,gBAAA;AAAA,kBACC,MAAM,GAAG,+BAAa,UAAU,YAAY,OAAO,IAAI;AAAA,kBACvD,WAAU;AAAA,kBACX;AAAA;AAAA,oBACuB,OAAO;AAAA;AAAA;AAAA,cAC/B,GACF;AAAA,eACF;AAAA;AAAA;AAAA,QAlDK,OAAO,OAAO;AAAA,MAmDrB;AAAA,IAEJ,CAAC,GACH;AAAA,KACF;AAEJ;","names":["Link","Image"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
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 };
|
|
@@ -0,0 +1,10 @@
|
|
|
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 };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Image from "next/image";
|
|
3
|
+
import { opinlyConfig } from "../../sdk-config";
|
|
4
|
+
import { replaceImageNameSpace } from "../../utils/images";
|
|
5
|
+
import { PostPreview } from "../post-preview";
|
|
6
|
+
import { BreadCrumbs } from "../bread-crumbs";
|
|
7
|
+
import Link from "next/link";
|
|
8
|
+
const AuthorsPage = ({
|
|
9
|
+
authors
|
|
10
|
+
}) => {
|
|
11
|
+
return /* @__PURE__ */ jsxs("div", { className: "max-w-5xl mx-auto px-4 py-10", children: [
|
|
12
|
+
/* @__PURE__ */ jsx(
|
|
13
|
+
BreadCrumbs,
|
|
14
|
+
{
|
|
15
|
+
breadcrumbs: [
|
|
16
|
+
{
|
|
17
|
+
name: "Authors"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
),
|
|
22
|
+
/* @__PURE__ */ jsx("h1", { className: "text-3xl font-bold mb-10", children: "Authors" }),
|
|
23
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-16", children: authors.map((author, idx) => {
|
|
24
|
+
const authorSlug = `${opinlyConfig.blogPrefix}/authors/${author.slug}`;
|
|
25
|
+
return /* @__PURE__ */ jsxs(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
className: "rounded-lg p-6 flex flex-col gap-6",
|
|
29
|
+
children: [
|
|
30
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-6 mb-4", children: [
|
|
31
|
+
author.image?.fileKey && /* @__PURE__ */ jsx(Link, { href: authorSlug, children: /* @__PURE__ */ jsx(
|
|
32
|
+
Image,
|
|
33
|
+
{
|
|
34
|
+
src: `${opinlyConfig.imagesPrefix}/${replaceImageNameSpace(author.image.fileKey)}`,
|
|
35
|
+
alt: author.image.alt || author.name,
|
|
36
|
+
width: 100,
|
|
37
|
+
height: 100,
|
|
38
|
+
className: "rounded-full border"
|
|
39
|
+
}
|
|
40
|
+
) }),
|
|
41
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
42
|
+
/* @__PURE__ */ jsx(Link, { href: authorSlug, children: /* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold mb-1", children: author.name }) }),
|
|
43
|
+
author.bio && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-base max-w-2xl", children: author.bio })
|
|
44
|
+
] })
|
|
45
|
+
] }),
|
|
46
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
47
|
+
/* @__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(
|
|
48
|
+
(post) => post && /* @__PURE__ */ jsx(PostPreview, { post }, post.slug)
|
|
49
|
+
) : /* @__PURE__ */ jsx("div", { className: "text-muted-foreground col-span-full", children: "No posts yet." }) }),
|
|
50
|
+
/* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxs(
|
|
51
|
+
Link,
|
|
52
|
+
{
|
|
53
|
+
href: `${opinlyConfig.blogPrefix}/authors/${author.slug}`,
|
|
54
|
+
className: "text-bold",
|
|
55
|
+
children: [
|
|
56
|
+
"View more posts from ",
|
|
57
|
+
author.name
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
) })
|
|
61
|
+
] })
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
author.name + idx
|
|
65
|
+
);
|
|
66
|
+
}) })
|
|
67
|
+
] });
|
|
68
|
+
};
|
|
69
|
+
export {
|
|
70
|
+
AuthorsPage
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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 \"../../sdk-config\";\nimport { replaceImageNameSpace } from \"../../utils/images\";\nimport { PostPreview } from \"../post-preview\";\nimport { BreadCrumbs } from \"../bread-crumbs\";\nimport Link from \"next/link\";\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 <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}/${replaceImageNameSpace(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"],"mappings":"AAkBM,cA6BU,YA7BV;AAjBN,OAAO,WAAW;AAClB,SAAS,oBAAoB;AAC7B,SAAS,6BAA6B;AACtC,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,OAAO,UAAU;AAEV,MAAM,cAAc,CAAC;AAAA,EAC1B;AACF,MAKM;AACJ,SACE,qBAAC,SAAI,WAAU,gCACb;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,aAAa;AAAA,UACX;AAAA,YACE,MAAM;AAAA,UACR;AAAA,QACF;AAAA;AAAA,IACF;AAAA,IACA,oBAAC,QAAG,WAAU,4BAA2B,qBAAO;AAAA,IAChD,oBAAC,SAAI,WAAU,cACZ,kBAAQ,IAAI,CAAC,QAAQ,QAAQ;AAC5B,YAAM,aAAa,GAAG,aAAa,UAAU,YAAY,OAAO,IAAI;AAEpE,aACE;AAAA,QAAC;AAAA;AAAA,UAEC,WAAU;AAAA,UAEV;AAAA,iCAAC,SAAI,WAAU,gCACZ;AAAA,qBAAO,OAAO,WACb,oBAAC,QAAK,MAAM,YACV;AAAA,gBAAC;AAAA;AAAA,kBACC,KAAK,GAAG,aAAa,YAAY,IAAI,sBAAsB,OAAO,MAAM,OAAO,CAAC;AAAA,kBAChF,KAAK,OAAO,MAAM,OAAO,OAAO;AAAA,kBAChC,OAAO;AAAA,kBACP,QAAQ;AAAA,kBACR,WAAU;AAAA;AAAA,cACZ,GACF;AAAA,cAEF,qBAAC,SACC;AAAA,oCAAC,QAAK,MAAM,YACV,8BAAC,QAAG,WAAU,+BACX,iBAAO,MACV,GACF;AAAA,gBAEC,OAAO,OACN,oBAAC,OAAE,WAAU,6CACV,iBAAO,KACV;AAAA,iBAEJ;AAAA,eACF;AAAA,YACA,qBAAC,SACC;AAAA,kCAAC,SAAI,WAAU,6DACZ,iBAAO,SAAS,OAAO,MAAM,SAAS,IACrC,OAAO,MAAM;AAAA,gBACX,CAAC,SACC,QAAQ,oBAAC,eAA4B,QAAX,KAAK,IAAkB;AAAA,cACrD,IAEA,oBAAC,SAAI,WAAU,uCAAsC,2BAErD,GAEJ;AAAA,cACA,oBAAC,SAAI,WAAU,oBACb;AAAA,gBAAC;AAAA;AAAA,kBACC,MAAM,GAAG,aAAa,UAAU,YAAY,OAAO,IAAI;AAAA,kBACvD,WAAU;AAAA,kBACX;AAAA;AAAA,oBACuB,OAAO;AAAA;AAAA;AAAA,cAC/B,GACF;AAAA,eACF;AAAA;AAAA;AAAA,QAlDK,OAAO,OAAO;AAAA,MAmDrB;AAAA,IAEJ,CAAC,GACH;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,130 @@
|
|
|
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
|
+
function renderTiptapContent(content, classNames) {
|
|
38
|
+
if (!content?.content) return [];
|
|
39
|
+
return content.content.map((node, index) => {
|
|
40
|
+
switch (node.type) {
|
|
41
|
+
case "paragraph":
|
|
42
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: classNames.paragraph || "mb-4", children: renderChildren(node.content, classNames) }, index);
|
|
43
|
+
case "heading": {
|
|
44
|
+
const text = node.content?.[0]?.text ?? "";
|
|
45
|
+
const slug = text.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
46
|
+
const Tag = `h${node.attrs?.level || 1}`;
|
|
47
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
48
|
+
Tag,
|
|
49
|
+
{
|
|
50
|
+
id: slug,
|
|
51
|
+
className: classNames.heading || "mt-8 mb-4 font-bold text-gray-800",
|
|
52
|
+
children: renderChildren(node.content, classNames)
|
|
53
|
+
},
|
|
54
|
+
index
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
case "image":
|
|
58
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
className: (0, import_merge.cn)(
|
|
62
|
+
"relative w-full max-w-[800px] my-6",
|
|
63
|
+
classNames.image
|
|
64
|
+
),
|
|
65
|
+
style: { aspectRatio: "2 / 1" }
|
|
66
|
+
},
|
|
67
|
+
index
|
|
68
|
+
);
|
|
69
|
+
case "bulletList":
|
|
70
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
71
|
+
"ul",
|
|
72
|
+
{
|
|
73
|
+
className: classNames.bulletList || "list-disc pl-6 my-4",
|
|
74
|
+
children: renderChildren(node.content, classNames)
|
|
75
|
+
},
|
|
76
|
+
index
|
|
77
|
+
);
|
|
78
|
+
case "orderedList":
|
|
79
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
80
|
+
"ol",
|
|
81
|
+
{
|
|
82
|
+
className: classNames.orderedList || "list-decimal pl-6 my-4",
|
|
83
|
+
children: renderChildren(node.content, classNames)
|
|
84
|
+
},
|
|
85
|
+
index
|
|
86
|
+
);
|
|
87
|
+
case "listItem":
|
|
88
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: classNames.listItem || "my-1", children: renderChildren(node.content, classNames) }, index);
|
|
89
|
+
default:
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
}).filter(Boolean);
|
|
93
|
+
}
|
|
94
|
+
const Content = ({
|
|
95
|
+
content,
|
|
96
|
+
classNames
|
|
97
|
+
}) => {
|
|
98
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "prose min-w-full", children: renderTiptapContent(content, classNames) });
|
|
99
|
+
};
|
|
100
|
+
function renderChildren(nodes, classNames) {
|
|
101
|
+
if (!nodes) return [];
|
|
102
|
+
return nodes.map((child, idx) => {
|
|
103
|
+
if (child.type === "text") {
|
|
104
|
+
let text = child.text;
|
|
105
|
+
if (child.marks) {
|
|
106
|
+
child.marks.forEach((mark) => {
|
|
107
|
+
if (mark.type === "bold") text = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: text }, idx);
|
|
108
|
+
if (mark.type === "italic") text = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("em", { children: text }, idx);
|
|
109
|
+
if (mark.type === "link")
|
|
110
|
+
text = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
111
|
+
import_link.default,
|
|
112
|
+
{
|
|
113
|
+
href: mark.attrs?.href,
|
|
114
|
+
className: classNames.link || "text-blue-600 underline",
|
|
115
|
+
children: text
|
|
116
|
+
},
|
|
117
|
+
idx
|
|
118
|
+
);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: text }, idx);
|
|
122
|
+
}
|
|
123
|
+
return null;
|
|
124
|
+
}).filter(Boolean);
|
|
125
|
+
}
|
|
126
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
127
|
+
0 && (module.exports = {
|
|
128
|
+
Content
|
|
129
|
+
});
|
|
130
|
+
//# sourceMappingURL=content.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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\";\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-gray-800\"\n }\n >\n {renderChildren(node.content, classNames)}\n </Tag>\n );\n }\n case \"image\":\n return (\n <div\n key={index}\n className={cn(\n \"relative w-full max-w-[800px] my-6\",\n classNames.image\n )}\n style={{ aspectRatio: \"2 / 1\" }}\n >\n {/* <Image\n src={replaceImageHostname(\n node.attrs?.src || \"\",\n opinlyConfig.imagesPrefix\n )}\n alt={node.attrs?.alt || \"\"}\n fill\n className=\"object-contain rounded-lg\"\n sizes=\"(max-width: 800px) 100vw, 800px\"\n /> */}\n </div>\n );\n case \"bulletList\":\n return (\n <ul\n key={index}\n className={classNames.bulletList || \"list-disc pl-6 my-4\"}\n >\n {renderChildren(node.content, classNames)}\n </ul>\n );\n case \"orderedList\":\n return (\n <ol\n key={index}\n className={classNames.orderedList || \"list-decimal pl-6 my-4\"}\n >\n {renderChildren(node.content, classNames)}\n </ol>\n );\n case \"listItem\":\n return (\n <li key={index} className={classNames.listItem || \"my-1\"}>\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) return [];\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 }\n return null;\n })\n .filter(Boolean) as JSX.Element[];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBY;AAfZ,mBAAmB;AACnB,kBAAiB;AAGjB,SAAS,oBACP,SACA,YACmB;AACnB,MAAI,CAAC,SAAS,QAAS,QAAO,CAAC;AAE/B,SAAO,QAAQ,QACZ,IAAI,CAAC,MAAM,UAAU;AACpB,YAAQ,KAAK,MAAM;AAAA,MACjB,KAAK;AACH,eACE,4CAAC,OAAc,WAAW,WAAW,aAAa,QAC/C,yBAAe,KAAK,SAAS,UAAU,KADlC,KAER;AAAA,MAEJ,KAAK,WAAW;AACd,cAAM,OAAO,KAAK,UAAU,CAAC,GAAG,QAAQ;AACxC,cAAM,OAAO,KACV,YAAY,EACZ,QAAQ,eAAe,GAAG,EAC1B,QAAQ,YAAY,EAAE;AACzB,cAAM,MAAM,IACV,KAAK,OAAO,SAAS,CACvB;AACA,eACE;AAAA,UAAC;AAAA;AAAA,YAEC,IAAI;AAAA,YACJ,WACE,WAAW,WAAW;AAAA,YAGvB,yBAAe,KAAK,SAAS,UAAU;AAAA;AAAA,UANnC;AAAA,QAOP;AAAA,MAEJ;AAAA,MACA,KAAK;AACH,eACE;AAAA,UAAC;AAAA;AAAA,YAEC,eAAW;AAAA,cACT;AAAA,cACA,WAAW;AAAA,YACb;AAAA,YACA,OAAO,EAAE,aAAa,QAAQ;AAAA;AAAA,UALzB;AAAA,QAiBP;AAAA,MAEJ,KAAK;AACH,eACE;AAAA,UAAC;AAAA;AAAA,YAEC,WAAW,WAAW,cAAc;AAAA,YAEnC,yBAAe,KAAK,SAAS,UAAU;AAAA;AAAA,UAHnC;AAAA,QAIP;AAAA,MAEJ,KAAK;AACH,eACE;AAAA,UAAC;AAAA;AAAA,YAEC,WAAW,WAAW,eAAe;AAAA,YAEpC,yBAAe,KAAK,SAAS,UAAU;AAAA;AAAA,UAHnC;AAAA,QAIP;AAAA,MAEJ,KAAK;AACH,eACE,4CAAC,QAAe,WAAW,WAAW,YAAY,QAC/C,yBAAe,KAAK,SAAS,UAAU,KADjC,KAET;AAAA,MAEJ;AACE,eAAO;AAAA,IACX;AAAA,EACF,CAAC,EACA,OAAO,OAAO;AACnB;AAEO,MAAM,UAAU,CAAC;AAAA,EACtB;AAAA,EACA;AACF,MAGM;AACJ,SACE,4CAAC,SAAI,WAAU,oBACZ,8BAAoB,SAAS,UAAU,GAC1C;AAEJ;AAEA,SAAS,eACP,OACA,YACe;AACf,MAAI,CAAC,MAAO,QAAO,CAAC;AAEpB,SAAO,MACJ,IAAI,CAAC,OAAO,QAAQ;AACnB,QAAI,MAAM,SAAS,QAAQ;AACzB,UAAI,OAAwB,MAAM;AAClC,UAAI,MAAM,OAAO;AACf,cAAM,MAAM,QAAQ,CAAC,SAAS;AAC5B,cAAI,KAAK,SAAS,OAAQ,QAAO,4CAAC,YAAkB,kBAAN,GAAW;AACzD,cAAI,KAAK,SAAS,SAAU,QAAO,4CAAC,QAAc,kBAAN,GAAW;AACvD,cAAI,KAAK,SAAS;AAChB,mBACE;AAAA,cAAC,YAAAA;AAAA,cAAA;AAAA,gBAEC,MAAM,KAAK,OAAO;AAAA,gBAClB,WAAW,WAAW,QAAQ;AAAA,gBAE7B;AAAA;AAAA,cAJI;AAAA,YAKP;AAAA,QAEN,CAAC;AAAA,MACH;AACA,aAAO,4CAAC,UAAgB,kBAAN,GAAW;AAAA,IAC/B;AACA,WAAO;AAAA,EACT,CAAC,EACA,OAAO,OAAO;AACnB;","names":["Link"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { JSONContent } from '@tiptap/core';
|
|
3
|
+
import { BlogComponentClassNames } from '../_types/class-names.cjs';
|
|
4
|
+
|
|
5
|
+
declare const Content: ({ content, classNames, }: {
|
|
6
|
+
content: JSONContent;
|
|
7
|
+
classNames: BlogComponentClassNames;
|
|
8
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { Content };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { JSONContent } from '@tiptap/core';
|
|
3
|
+
import { BlogComponentClassNames } from '../_types/class-names.js';
|
|
4
|
+
|
|
5
|
+
declare const Content: ({ content, classNames, }: {
|
|
6
|
+
content: JSONContent;
|
|
7
|
+
classNames: BlogComponentClassNames;
|
|
8
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { Content };
|