@opinly/next 0.1.12 → 0.1.14
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.js +1 -0
- package/dist/components/author-page/_helpers/json-ld.mjs +1 -0
- package/dist/components/author-page/index.js +57 -22
- package/dist/components/author-page/index.js.map +1 -1
- package/dist/components/author-page/index.mjs +50 -0
- package/dist/components/author-page/index.mjs.map +1 -0
- package/dist/components/authors-page/index.js +63 -29
- package/dist/components/authors-page/index.js.map +1 -1
- package/dist/components/authors-page/index.mjs +71 -0
- package/dist/components/authors-page/{index.cjs.map → index.mjs.map} +1 -1
- package/dist/components/blog-post/_components/content.js +63 -28
- package/dist/components/blog-post/_components/content.js.map +1 -1
- package/dist/components/blog-post/_components/content.mjs +126 -0
- package/dist/components/blog-post/_components/content.mjs.map +1 -0
- package/dist/components/blog-post/_components/faq.js +32 -8
- package/dist/components/blog-post/_components/faq.js.map +1 -1
- package/dist/components/blog-post/_components/faq.mjs +15 -0
- package/dist/components/blog-post/_components/{faq.cjs.map → faq.mjs.map} +1 -1
- package/dist/components/blog-post/_components/share.js +58 -24
- package/dist/components/blog-post/_components/share.js.map +1 -1
- package/dist/components/blog-post/_components/share.mjs +66 -0
- package/dist/components/blog-post/_components/{share.cjs.map → share.mjs.map} +1 -1
- package/dist/components/blog-post/_components/table-of-contents.js +58 -23
- package/dist/components/blog-post/_components/table-of-contents.js.map +1 -1
- package/dist/components/blog-post/_components/table-of-contents.mjs +48 -0
- package/dist/components/blog-post/_components/table-of-contents.mjs.map +1 -0
- package/dist/components/blog-post/_helpers/calc-reading-time.js +1 -0
- package/dist/components/blog-post/_helpers/calc-reading-time.mjs +1 -0
- package/dist/components/blog-post/_helpers/extract-headings.js +26 -2
- package/dist/components/blog-post/_helpers/extract-headings.js.map +1 -1
- package/dist/components/blog-post/_helpers/extract-headings.mjs +20 -0
- package/dist/components/blog-post/_helpers/{extract-headings.cjs.map → extract-headings.mjs.map} +1 -1
- package/dist/components/blog-post/_helpers/json-ld.js +38 -11
- package/dist/components/blog-post/_helpers/json-ld.js.map +1 -1
- package/dist/components/blog-post/_helpers/{json-ld.cjs → json-ld.mjs} +12 -39
- package/dist/components/blog-post/_helpers/{json-ld.cjs.map → json-ld.mjs.map} +1 -1
- package/dist/components/blog-post/_helpers/reading-time.js +27 -2
- package/dist/components/blog-post/_helpers/reading-time.js.map +1 -1
- package/dist/components/blog-post/_helpers/reading-time.mjs +25 -0
- package/dist/components/blog-post/_helpers/{reading-time.cjs.map → reading-time.mjs.map} +1 -1
- package/dist/components/blog-post/_types/blog-post.js +16 -0
- package/dist/components/blog-post/_types/blog-post.js.map +1 -1
- package/dist/components/blog-post/_types/blog-post.mjs +1 -0
- package/dist/components/blog-post/_types/blog-post.mjs.map +1 -0
- package/dist/components/blog-post/_types/class-names.js +16 -0
- package/dist/components/blog-post/_types/class-names.js.map +1 -1
- package/dist/components/blog-post/_types/class-names.mjs +1 -0
- package/dist/components/blog-post/_types/class-names.mjs.map +1 -0
- package/dist/components/blog-post/index.js +77 -47
- package/dist/components/blog-post/index.js.map +1 -1
- package/dist/components/blog-post/index.mjs +118 -0
- package/dist/components/blog-post/{index.cjs.map → index.mjs.map} +1 -1
- package/dist/components/bread-crumbs.js +47 -13
- package/dist/components/bread-crumbs.js.map +1 -1
- package/dist/components/bread-crumbs.mjs +26 -0
- package/dist/components/{bread-crumbs.cjs.map → bread-crumbs.mjs.map} +1 -1
- package/dist/components/folder-page/index.js +36 -12
- package/dist/components/folder-page/index.js.map +1 -1
- package/dist/components/folder-page/index.mjs +37 -0
- package/dist/components/folder-page/{index.cjs.map → index.mjs.map} +1 -1
- package/dist/components/home-page/folders.js +64 -29
- package/dist/components/home-page/folders.js.map +1 -1
- package/dist/components/home-page/folders.mjs +63 -0
- package/dist/components/home-page/{folders.cjs.map → folders.mjs.map} +1 -1
- package/dist/components/home-page/index.js +35 -11
- package/dist/components/home-page/index.js.map +1 -1
- package/dist/components/home-page/index.mjs +20 -0
- package/dist/components/home-page/{index.cjs.map → index.mjs.map} +1 -1
- package/dist/components/home-page/pagination.js +43 -9
- package/dist/components/home-page/pagination.js.map +1 -1
- package/dist/components/home-page/pagination.mjs +57 -0
- package/dist/components/home-page/{pagination.cjs.map → pagination.mjs.map} +1 -1
- package/dist/components/home-page/top-posts.js +34 -10
- package/dist/components/home-page/top-posts.js.map +1 -1
- package/dist/components/home-page/top-posts.mjs +28 -0
- package/dist/components/home-page/{top-posts.cjs.map → top-posts.mjs.map} +1 -1
- package/dist/components/not-found.js +49 -15
- package/dist/components/not-found.js.map +1 -1
- package/dist/components/not-found.mjs +26 -0
- package/dist/components/{not-found.cjs.map → not-found.mjs.map} +1 -1
- package/dist/components/opinly-blog.js +39 -15
- package/dist/components/opinly-blog.js.map +1 -1
- package/dist/components/opinly-blog.mjs +33 -0
- package/dist/components/{opinly-blog.cjs.map → opinly-blog.mjs.map} +1 -1
- package/dist/components/post-preview.js +77 -41
- package/dist/components/post-preview.js.map +1 -1
- package/dist/components/post-preview.mjs +77 -0
- package/dist/components/post-preview.mjs.map +1 -0
- package/dist/index.js +22 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/dist/utils/dates.js +26 -2
- package/dist/utils/dates.js.map +1 -1
- package/dist/utils/dates.mjs +9 -0
- package/dist/utils/{dates.cjs.map → dates.mjs.map} +1 -1
- package/dist/utils/generate-metadata.d.cts +5 -3
- package/dist/utils/generate-metadata.d.ts +5 -3
- package/dist/utils/generate-metadata.js +33 -9
- package/dist/utils/generate-metadata.js.map +1 -1
- package/dist/utils/generate-metadata.mjs +36 -0
- package/dist/utils/generate-metadata.mjs.map +1 -0
- package/dist/utils/merge.js +29 -5
- package/dist/utils/merge.js.map +1 -1
- package/dist/utils/merge.mjs +9 -0
- package/dist/utils/{merge.cjs.map → merge.mjs.map} +1 -1
- package/dist/utils/sdk-config.d.cts +1 -0
- package/dist/utils/sdk-config.d.ts +1 -0
- package/dist/utils/sdk-config.js +31 -4
- package/dist/utils/sdk-config.js.map +1 -1
- package/dist/utils/sdk-config.mjs +32 -0
- package/dist/utils/sdk-config.mjs.map +1 -0
- package/package.json +4 -4
- package/dist/components/author-page/_helpers/json-ld.cjs +0 -2
- package/dist/components/author-page/index.cjs +0 -83
- package/dist/components/author-page/index.cjs.map +0 -1
- package/dist/components/authors-page/index.cjs +0 -105
- package/dist/components/blog-post/_components/content.cjs +0 -159
- package/dist/components/blog-post/_components/content.cjs.map +0 -1
- package/dist/components/blog-post/_components/faq.cjs +0 -39
- package/dist/components/blog-post/_components/share.cjs +0 -100
- package/dist/components/blog-post/_components/table-of-contents.cjs +0 -81
- package/dist/components/blog-post/_components/table-of-contents.cjs.map +0 -1
- package/dist/components/blog-post/_helpers/calc-reading-time.cjs +0 -2
- package/dist/components/blog-post/_helpers/extract-headings.cjs +0 -44
- package/dist/components/blog-post/_helpers/reading-time.cjs +0 -50
- 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/class-names.cjs +0 -17
- package/dist/components/blog-post/_types/class-names.cjs.map +0 -1
- package/dist/components/blog-post/index.cjs +0 -148
- package/dist/components/bread-crumbs.cjs +0 -60
- package/dist/components/folder-page/index.cjs +0 -61
- package/dist/components/home-page/folders.cjs +0 -98
- package/dist/components/home-page/index.cjs +0 -44
- package/dist/components/home-page/pagination.cjs +0 -91
- package/dist/components/home-page/top-posts.cjs +0 -52
- package/dist/components/not-found.cjs +0 -60
- package/dist/components/opinly-blog.cjs +0 -57
- package/dist/components/post-preview.cjs +0 -111
- package/dist/components/post-preview.cjs.map +0 -1
- package/dist/index.cjs +0 -23
- package/dist/index.cjs.map +0 -1
- package/dist/utils/dates.cjs +0 -33
- package/dist/utils/generate-metadata.cjs +0 -60
- package/dist/utils/generate-metadata.cjs.map +0 -1
- package/dist/utils/merge.cjs +0 -33
- package/dist/utils/sdk-config.cjs +0 -55
- package/dist/utils/sdk-config.cjs.map +0 -1
- /package/dist/components/author-page/_helpers/{json-ld.cjs.map → json-ld.mjs.map} +0 -0
- /package/dist/components/blog-post/_helpers/{calc-reading-time.cjs.map → calc-reading-time.mjs.map} +0 -0
|
@@ -1,105 +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
|
-
const AuthorsPage = ({
|
|
41
|
-
authors
|
|
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
|
-
}
|
|
51
|
-
]
|
|
52
|
-
}
|
|
53
|
-
),
|
|
54
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { className: "text-3xl font-bold mb-10", children: "Authors" }),
|
|
55
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "space-y-16", children: authors.map((author, idx) => {
|
|
56
|
-
const authorSlug = `${import_sdk_config.opinlyConfig.blogPrefix}/authors/${author.slug}`;
|
|
57
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
58
|
-
"div",
|
|
59
|
-
{
|
|
60
|
-
className: "rounded-lg p-6 flex flex-col gap-6",
|
|
61
|
-
children: [
|
|
62
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-6 mb-4", children: [
|
|
63
|
-
author.image?.fileKey && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.default, { href: authorSlug, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
64
|
-
import_image.default,
|
|
65
|
-
{
|
|
66
|
-
src: `${import_sdk_config.opinlyConfig.imagesPrefix}/${author.image.fileKey}`,
|
|
67
|
-
alt: author.image.alt || author.name,
|
|
68
|
-
width: 100,
|
|
69
|
-
height: 100,
|
|
70
|
-
className: "rounded-full border"
|
|
71
|
-
}
|
|
72
|
-
) }),
|
|
73
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
74
|
-
/* @__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 }) }),
|
|
75
|
-
author.bio && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-muted-foreground text-base max-w-2xl", children: author.bio })
|
|
76
|
-
] })
|
|
77
|
-
] }),
|
|
78
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
79
|
-
/* @__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(
|
|
80
|
-
(post) => post && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_post_preview.PostPreview, { post }, post.slug)
|
|
81
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-muted-foreground col-span-full", children: "No posts yet." }) }),
|
|
82
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
83
|
-
import_link.default,
|
|
84
|
-
{
|
|
85
|
-
href: `${import_sdk_config.opinlyConfig.blogPrefix}/authors/${author.slug}`,
|
|
86
|
-
className: "text-bold",
|
|
87
|
-
children: [
|
|
88
|
-
"View more posts from ",
|
|
89
|
-
author.name
|
|
90
|
-
]
|
|
91
|
-
}
|
|
92
|
-
) })
|
|
93
|
-
] })
|
|
94
|
-
]
|
|
95
|
-
},
|
|
96
|
-
author.name + idx
|
|
97
|
-
);
|
|
98
|
-
}) })
|
|
99
|
-
] });
|
|
100
|
-
};
|
|
101
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
102
|
-
0 && (module.exports = {
|
|
103
|
-
AuthorsPage
|
|
104
|
-
});
|
|
105
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,159 +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-gray-800",
|
|
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
|
-
"relative w-full max-w-[800px] my-6",
|
|
70
|
-
classNames.image
|
|
71
|
-
),
|
|
72
|
-
style: { aspectRatio: "2 / 1" },
|
|
73
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
74
|
-
import_image.default,
|
|
75
|
-
{
|
|
76
|
-
src: `${import_sdk_config.opinlyConfig.imagesPrefix}/${fileKey}`,
|
|
77
|
-
title: node.attrs?.title || "",
|
|
78
|
-
alt: node.attrs?.alt || "",
|
|
79
|
-
fill: true,
|
|
80
|
-
className: "object-contain rounded-lg",
|
|
81
|
-
sizes: "(max-width: 800px) 100vw, 800px"
|
|
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
|
-
console.log("no nodes");
|
|
124
|
-
return [];
|
|
125
|
-
}
|
|
126
|
-
return nodes.map((child, idx) => {
|
|
127
|
-
if (child.type === "text") {
|
|
128
|
-
let text = child.text;
|
|
129
|
-
if (child.marks) {
|
|
130
|
-
child.marks.forEach((mark) => {
|
|
131
|
-
if (mark.type === "bold") text = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: text }, idx);
|
|
132
|
-
if (mark.type === "italic") text = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("em", { children: text }, idx);
|
|
133
|
-
if (mark.type === "link")
|
|
134
|
-
text = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
135
|
-
import_link.default,
|
|
136
|
-
{
|
|
137
|
-
href: mark.attrs?.href,
|
|
138
|
-
className: classNames.link || "text-blue-600 underline",
|
|
139
|
-
children: text
|
|
140
|
-
},
|
|
141
|
-
idx
|
|
142
|
-
);
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: text }, idx);
|
|
146
|
-
} else {
|
|
147
|
-
console.log("child", child);
|
|
148
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react2.default.Fragment, { children: renderTiptapContent(
|
|
149
|
-
{ ...child, content: child.content },
|
|
150
|
-
classNames
|
|
151
|
-
) }, idx);
|
|
152
|
-
}
|
|
153
|
-
}).filter(Boolean);
|
|
154
|
-
}
|
|
155
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
156
|
-
0 && (module.exports = {
|
|
157
|
-
Content
|
|
158
|
-
});
|
|
159
|
-
//# 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-gray-800\"\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 \"relative w-full max-w-[800px] my-6\",\n classNames.image\n )}\n style={{ aspectRatio: \"2 / 1\" }}\n >\n <Image\n src={`${opinlyConfig.imagesPrefix}/${fileKey}`}\n title={node.attrs?.title || \"\"}\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={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 console.log(\"no 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 console.log(\"child\", child);\n\n // Recursively render non-text nodes (e.g., paragraph, listItem, etc.)\n return (\n <React.Fragment key={idx}>\n {renderTiptapContent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,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,YAAAC;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,OAAO;AACL,cAAQ,IAAI,SAAS,KAAK;AAG1B,aACE,4CAAC,cAAAC,QAAM,UAAN,EACE;AAAA,QACC,EAAE,GAAG,OAAO,SAAS,MAAM,QAAQ;AAAA,QACnC;AAAA,MACF,KAJmB,GAKrB;AAAA,IAEJ;AAAA,EACF,CAAC,EACA,OAAO,OAAO;AACnB;","names":["import_react","Image","Link","React"]}
|
|
@@ -1,39 +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 faq_exports = {};
|
|
20
|
-
__export(faq_exports, {
|
|
21
|
-
FAQS: () => FAQS
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(faq_exports);
|
|
24
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
-
const FAQS = ({ faqs }) => {
|
|
26
|
-
if (!faqs) return null;
|
|
27
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
28
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "text-lg font-semibold mb-2", children: "FAQS" }),
|
|
29
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { children: faqs.map((faq) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { children: [
|
|
30
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "text-lg font-semibold mb-2", children: faq.question }),
|
|
31
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-gray-700", children: faq.answer })
|
|
32
|
-
] }, faq.question)) })
|
|
33
|
-
] });
|
|
34
|
-
};
|
|
35
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
-
0 && (module.exports = {
|
|
37
|
-
FAQS
|
|
38
|
-
});
|
|
39
|
-
//# sourceMappingURL=faq.cjs.map
|
|
@@ -1,100 +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 share_exports = {};
|
|
30
|
-
__export(share_exports, {
|
|
31
|
-
Share: () => Share
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(share_exports);
|
|
34
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
-
var import_lucide_react = require("lucide-react");
|
|
36
|
-
var import_link = __toESM(require("next/link"), 1);
|
|
37
|
-
var import_sdk_config = require("../../../utils/sdk-config");
|
|
38
|
-
const Share = ({ post }) => {
|
|
39
|
-
const postUrl = encodeURIComponent(`${import_sdk_config.opinlyConfig.blogUrl}/${post.slug}`);
|
|
40
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex gap-2 mb-6", children: [
|
|
41
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
42
|
-
import_link.default,
|
|
43
|
-
{
|
|
44
|
-
href: `https://linkedin.com/sharing/share-offsite?url=${postUrl}`,
|
|
45
|
-
target: "_blank",
|
|
46
|
-
rel: "noopener noreferrer",
|
|
47
|
-
className: "border p-1 rounded flex items-center justify-center w-8 h-8",
|
|
48
|
-
children: [
|
|
49
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only", children: "Share on LinkedIn" }),
|
|
50
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Linkedin, { className: "w-4 h-4" })
|
|
51
|
-
]
|
|
52
|
-
}
|
|
53
|
-
),
|
|
54
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
55
|
-
import_link.default,
|
|
56
|
-
{
|
|
57
|
-
href: `https://twitter.com/intent/tweet?url=${postUrl}&text=${encodeURIComponent(
|
|
58
|
-
`Check out this article by ${post.author?.name}`
|
|
59
|
-
)}`,
|
|
60
|
-
target: "_blank",
|
|
61
|
-
rel: "noopener noreferrer",
|
|
62
|
-
className: "border p-1 rounded flex items-center justify-center w-8 h-8",
|
|
63
|
-
children: [
|
|
64
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only", children: "Share on Twitter" }),
|
|
65
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Twitter, {})
|
|
66
|
-
]
|
|
67
|
-
}
|
|
68
|
-
),
|
|
69
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
70
|
-
import_link.default,
|
|
71
|
-
{
|
|
72
|
-
href: `https://facebook.com/sharer/sharer.php?u=${postUrl}`,
|
|
73
|
-
target: "_blank",
|
|
74
|
-
rel: "noopener noreferrer",
|
|
75
|
-
className: "border p-1 rounded flex items-center justify-center w-8 h-8",
|
|
76
|
-
children: [
|
|
77
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only", children: "Share on Facebook" }),
|
|
78
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Facebook, {})
|
|
79
|
-
]
|
|
80
|
-
}
|
|
81
|
-
),
|
|
82
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
83
|
-
import_link.default,
|
|
84
|
-
{
|
|
85
|
-
href: `mailto:?body=${encodeURIComponent(`${post.title}
|
|
86
|
-
${postUrl}`)}`,
|
|
87
|
-
className: "border p-1 rounded flex items-center justify-center w-8 h-8",
|
|
88
|
-
children: [
|
|
89
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only", children: "Share via Email" }),
|
|
90
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Mail, { className: "w-4 h-4" })
|
|
91
|
-
]
|
|
92
|
-
}
|
|
93
|
-
)
|
|
94
|
-
] });
|
|
95
|
-
};
|
|
96
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
97
|
-
0 && (module.exports = {
|
|
98
|
-
Share
|
|
99
|
-
});
|
|
100
|
-
//# sourceMappingURL=share.cjs.map
|
|
@@ -1,81 +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 table_of_contents_exports = {};
|
|
30
|
-
__export(table_of_contents_exports, {
|
|
31
|
-
TableOfContents: () => TableOfContents
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(table_of_contents_exports);
|
|
34
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
-
var import_merge = require("../../../utils/merge");
|
|
36
|
-
var import_image = __toESM(require("next/image"), 1);
|
|
37
|
-
var import_sdk_config = require("../../../utils/sdk-config");
|
|
38
|
-
var import_extract_headings = require("../_helpers/extract-headings");
|
|
39
|
-
var import_share = require("./share");
|
|
40
|
-
var import_link = __toESM(require("next/link"), 1);
|
|
41
|
-
const TableOfContents = ({
|
|
42
|
-
content,
|
|
43
|
-
author,
|
|
44
|
-
post
|
|
45
|
-
}) => {
|
|
46
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("aside", { className: (0, import_merge.cn)("w-full lg:w-1/3 lg:sticky lg:top-20 lg:self-start"), children: [
|
|
47
|
-
author && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "w-full mb-6 border p-4 rounded-md text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-3 mb-3", children: [
|
|
48
|
-
author.fileKey && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
49
|
-
import_image.default,
|
|
50
|
-
{
|
|
51
|
-
src: `${import_sdk_config.opinlyConfig.imagesPrefix}/${author.fileKey}`,
|
|
52
|
-
alt: author.name,
|
|
53
|
-
width: 48,
|
|
54
|
-
height: 48,
|
|
55
|
-
className: "rounded-full"
|
|
56
|
-
}
|
|
57
|
-
),
|
|
58
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
59
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
60
|
-
import_link.default,
|
|
61
|
-
{
|
|
62
|
-
href: `${import_sdk_config.opinlyConfig.blogPrefix}/authors/${author.slug}`,
|
|
63
|
-
className: "text-xs uppercase text-muted-foreground font-medium",
|
|
64
|
-
children: author.name
|
|
65
|
-
}
|
|
66
|
-
),
|
|
67
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-muted-foreground text-sm", children: author.bio })
|
|
68
|
-
] })
|
|
69
|
-
] }) }),
|
|
70
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_share.Share, { post }),
|
|
71
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "border-l-4 border-opinlyAccent pl-4 mb-4", children: [
|
|
72
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "text-lg font-semibold mb-2", children: "TABLE OF CONTENTS" }),
|
|
73
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "text-sm text-gray-700 space-y-1", children: ((0, import_extract_headings.extractHeadings)(content) || []).map((heading) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: `#${heading.slug}`, className: "hover:underline", children: heading.text }) }, heading.slug)) })
|
|
74
|
-
] })
|
|
75
|
-
] });
|
|
76
|
-
};
|
|
77
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
78
|
-
0 && (module.exports = {
|
|
79
|
-
TableOfContents
|
|
80
|
-
});
|
|
81
|
-
//# sourceMappingURL=table-of-contents.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/blog-post/_components/table-of-contents.tsx"],"sourcesContent":["import { JSONContent } from \"@tiptap/core\";\nimport { BlogPostRes } from \"../_types/blog-post\";\nimport { cn } from \"../../../utils/merge\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../../../utils/sdk-config\";\nimport { extractHeadings } from \"../_helpers/extract-headings\";\nimport { Share } from \"./share\";\nimport Link from \"next/link\";\n\ntype TableOfContentsProps = {\n content: JSONContent;\n author: BlogPostRes[\"author\"] | null;\n post: BlogPostRes;\n};\n\nexport const TableOfContents = ({\n content,\n author,\n post,\n}: TableOfContentsProps) => {\n return (\n <aside className={cn(\"w-full lg:w-1/3 lg:sticky lg:top-20 lg:self-start\")}>\n {author && (\n <div className=\"w-full mb-6 border p-4 rounded-md text-sm\">\n <div className=\"flex items-center gap-3 mb-3\">\n {author.fileKey && (\n <Image\n src={`${opinlyConfig.imagesPrefix}/${author.fileKey}`}\n alt={author.name}\n width={48}\n height={48}\n className=\"rounded-full\"\n />\n )}\n <div>\n <Link\n href={`${opinlyConfig.blogPrefix}/authors/${author.slug}`}\n className=\"text-xs uppercase text-muted-foreground font-medium\"\n >\n {author.name}\n </Link>\n <div className=\"text-muted-foreground text-sm\">{author.bio}</div>\n </div>\n </div>\n </div>\n )}\n <Share post={post} />\n <div className=\"border-l-4 border-opinlyAccent pl-4 mb-4\">\n <h2 className=\"text-lg font-semibold mb-2\">TABLE OF CONTENTS</h2>\n <ul className=\"text-sm text-gray-700 space-y-1\">\n {(extractHeadings(content) || []).map((heading) => (\n <li key={heading.slug}>\n <a href={`#${heading.slug}`} className=\"hover:underline\">\n {heading.text}\n </a>\n </li>\n ))}\n </ul>\n </div>\n </aside>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;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wnPropDesc = 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 extract_headings_exports = {};
|
|
20
|
-
__export(extract_headings_exports, {
|
|
21
|
-
extractHeadings: () => extractHeadings
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(extract_headings_exports);
|
|
24
|
-
function extractHeadings(content) {
|
|
25
|
-
const headings = [];
|
|
26
|
-
if (!content?.content) return headings;
|
|
27
|
-
const walk = (nodes) => {
|
|
28
|
-
for (const node of nodes) {
|
|
29
|
-
if (node.type === "heading" && node.content?.[0]?.text) {
|
|
30
|
-
const text = node.content[0].text;
|
|
31
|
-
const slug = text.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
32
|
-
headings.push({ text, slug });
|
|
33
|
-
}
|
|
34
|
-
if (node.content) walk(node.content);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
walk(content.content);
|
|
38
|
-
return headings;
|
|
39
|
-
}
|
|
40
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
-
0 && (module.exports = {
|
|
42
|
-
extractHeadings
|
|
43
|
-
});
|
|
44
|
-
//# sourceMappingURL=extract-headings.cjs.map
|
|
@@ -1,50 +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 reading_time_exports = {};
|
|
20
|
-
__export(reading_time_exports, {
|
|
21
|
-
calculateReadingTime: () => calculateReadingTime,
|
|
22
|
-
countWords: () => countWords
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(reading_time_exports);
|
|
25
|
-
const countWords = (content) => {
|
|
26
|
-
if (!content?.content) return 0;
|
|
27
|
-
let wordCount = 0;
|
|
28
|
-
const countWords2 = (nodes) => {
|
|
29
|
-
for (const node of nodes) {
|
|
30
|
-
if (node.type === "text" && node.text) {
|
|
31
|
-
const words = node.text.trim().split(/\s+/).filter(Boolean);
|
|
32
|
-
wordCount += words.length;
|
|
33
|
-
}
|
|
34
|
-
if (node.content) countWords2(node.content);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
countWords2(content.content);
|
|
38
|
-
return wordCount;
|
|
39
|
-
};
|
|
40
|
-
function calculateReadingTime(content) {
|
|
41
|
-
const wordCount = countWords(content.content);
|
|
42
|
-
const readingTimeMinutes = Math.ceil(wordCount / 200);
|
|
43
|
-
return readingTimeMinutes;
|
|
44
|
-
}
|
|
45
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
-
0 && (module.exports = {
|
|
47
|
-
calculateReadingTime,
|
|
48
|
-
countWords
|
|
49
|
-
});
|
|
50
|
-
//# sourceMappingURL=reading-time.cjs.map
|
|
@@ -1,17 +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 __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var blog_post_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(blog_post_exports);
|
|
17
|
-
//# sourceMappingURL=blog-post.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/blog-post/_types/blog-post.ts"],"sourcesContent":["import type { Opinly } from \"@opinly/backend\";\n\nexport type BlogPostRes = Extract<\n Awaited<ReturnType<Opinly[\"content\"][\"blog\"]>>,\n { type: \"post\" }\n>[\"data\"];\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -1,17 +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 __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var class_names_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(class_names_exports);
|
|
17
|
-
//# sourceMappingURL=class-names.cjs.map
|