@opinly/next 0.1.13 → 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 +2 -2
- 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 +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\";\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(\n { ...child, content: child.content },\n classNames\n )}\n </React.Fragment>\n );\n }\n })\n .filter(Boolean) as JSX.Element[];\n}\n"],"mappings":"AAoBY;AAlBZ,
|
|
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 unoptimized={opinlyConfig.unoptimizedImages}\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(\n { ...child, content: child.content },\n classNames\n )}\n </React.Fragment>\n );\n }\n })\n .filter(Boolean) as JSX.Element[];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBY;AAlBZ,mBAAmB;AACnB,kBAAiB;AAEjB,mBAAkB;AAClB,wBAA6B;AAC7B,IAAAA,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M,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"]}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../../utils/merge";
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
import Image from "next/image";
|
|
5
|
+
import { opinlyConfig } from "../../../utils/sdk-config";
|
|
6
|
+
import React from "react";
|
|
7
|
+
function renderTiptapContent(content, classNames) {
|
|
8
|
+
if (!content?.content) return [];
|
|
9
|
+
return content.content.map((node, index) => {
|
|
10
|
+
switch (node.type) {
|
|
11
|
+
case "paragraph":
|
|
12
|
+
return /* @__PURE__ */ jsx("p", { className: classNames.paragraph || "mb-4", children: renderChildren(node.content, classNames) }, index);
|
|
13
|
+
case "heading": {
|
|
14
|
+
const text = node.content?.[0]?.text ?? "";
|
|
15
|
+
const slug = text.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
16
|
+
const Tag = `h${node.attrs?.level || 1}`;
|
|
17
|
+
return /* @__PURE__ */ jsx(
|
|
18
|
+
Tag,
|
|
19
|
+
{
|
|
20
|
+
id: slug,
|
|
21
|
+
className: classNames.heading || "mt-8 mb-4 font-bold text-gray-800",
|
|
22
|
+
children: renderChildren(node.content, classNames)
|
|
23
|
+
},
|
|
24
|
+
index
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
case "image":
|
|
28
|
+
const fileKey = node.attrs?.fileKey;
|
|
29
|
+
if (!fileKey) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
return /* @__PURE__ */ jsx(
|
|
33
|
+
"div",
|
|
34
|
+
{
|
|
35
|
+
className: cn(
|
|
36
|
+
"relative w-full max-w-[800px] my-6",
|
|
37
|
+
classNames.image
|
|
38
|
+
),
|
|
39
|
+
style: { aspectRatio: "2 / 1" },
|
|
40
|
+
children: /* @__PURE__ */ jsx(
|
|
41
|
+
Image,
|
|
42
|
+
{
|
|
43
|
+
unoptimized: opinlyConfig.unoptimizedImages,
|
|
44
|
+
src: `${opinlyConfig.imagesPrefix}/${fileKey}`,
|
|
45
|
+
title: node.attrs?.title || "",
|
|
46
|
+
alt: node.attrs?.alt || "",
|
|
47
|
+
fill: true,
|
|
48
|
+
className: "object-contain rounded-lg",
|
|
49
|
+
sizes: "(max-width: 800px) 100vw, 800px"
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
},
|
|
53
|
+
index
|
|
54
|
+
);
|
|
55
|
+
case "bulletList":
|
|
56
|
+
return /* @__PURE__ */ jsx(
|
|
57
|
+
"ul",
|
|
58
|
+
{
|
|
59
|
+
className: cn("list-disc pl-6 my-4", classNames.bulletList),
|
|
60
|
+
children: renderTiptapContent(node, classNames)
|
|
61
|
+
},
|
|
62
|
+
index
|
|
63
|
+
);
|
|
64
|
+
case "orderedList":
|
|
65
|
+
return /* @__PURE__ */ jsx(
|
|
66
|
+
"ol",
|
|
67
|
+
{
|
|
68
|
+
className: cn("list-decimal pl-6 my-4", classNames.orderedList),
|
|
69
|
+
children: renderTiptapContent(node, classNames)
|
|
70
|
+
},
|
|
71
|
+
index
|
|
72
|
+
);
|
|
73
|
+
case "listItem":
|
|
74
|
+
if (node.content && node.content.length === 1 && node.content[0].type === "paragraph") {
|
|
75
|
+
return /* @__PURE__ */ jsx("li", { className: cn("my-1", classNames.listItem), children: renderChildren(node.content[0].content, classNames) }, index);
|
|
76
|
+
}
|
|
77
|
+
return /* @__PURE__ */ jsx("li", { className: cn("my-1", classNames.listItem), children: renderChildren(node.content, classNames) }, index);
|
|
78
|
+
default:
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
}).filter(Boolean);
|
|
82
|
+
}
|
|
83
|
+
const Content = ({
|
|
84
|
+
content,
|
|
85
|
+
classNames
|
|
86
|
+
}) => {
|
|
87
|
+
return /* @__PURE__ */ jsx("div", { className: "prose min-w-full", children: renderTiptapContent(content, classNames) });
|
|
88
|
+
};
|
|
89
|
+
function renderChildren(nodes, classNames) {
|
|
90
|
+
if (!nodes) {
|
|
91
|
+
console.log("no nodes");
|
|
92
|
+
return [];
|
|
93
|
+
}
|
|
94
|
+
return nodes.map((child, idx) => {
|
|
95
|
+
if (child.type === "text") {
|
|
96
|
+
let text = child.text;
|
|
97
|
+
if (child.marks) {
|
|
98
|
+
child.marks.forEach((mark) => {
|
|
99
|
+
if (mark.type === "bold") text = /* @__PURE__ */ jsx("strong", { children: text }, idx);
|
|
100
|
+
if (mark.type === "italic") text = /* @__PURE__ */ jsx("em", { children: text }, idx);
|
|
101
|
+
if (mark.type === "link")
|
|
102
|
+
text = /* @__PURE__ */ jsx(
|
|
103
|
+
Link,
|
|
104
|
+
{
|
|
105
|
+
href: mark.attrs?.href,
|
|
106
|
+
className: classNames.link || "text-blue-600 underline",
|
|
107
|
+
children: text
|
|
108
|
+
},
|
|
109
|
+
idx
|
|
110
|
+
);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
return /* @__PURE__ */ jsx("span", { children: text }, idx);
|
|
114
|
+
} else {
|
|
115
|
+
console.log("child", child);
|
|
116
|
+
return /* @__PURE__ */ jsx(React.Fragment, { children: renderTiptapContent(
|
|
117
|
+
{ ...child, content: child.content },
|
|
118
|
+
classNames
|
|
119
|
+
) }, idx);
|
|
120
|
+
}
|
|
121
|
+
}).filter(Boolean);
|
|
122
|
+
}
|
|
123
|
+
export {
|
|
124
|
+
Content
|
|
125
|
+
};
|
|
126
|
+
//# sourceMappingURL=content.mjs.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\";\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 unoptimized={opinlyConfig.unoptimizedImages}\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(\n { ...child, content: child.content },\n classNames\n )}\n </React.Fragment>\n );\n }\n })\n .filter(Boolean) as JSX.Element[];\n}\n"],"mappings":"AAoBY;AAlBZ,SAAS,UAAU;AACnB,OAAO,UAAU;AAEjB,OAAO,WAAW;AAClB,SAAS,o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AAA,gBAClB,WAAW,WAAW,QAAQ;AAAA,gBAE7B;AAAA;AAAA,cAJI;AAAA,YAKP;AAAA,QAEN,CAAC;AAAA,MACH;AACA,aAAO,oBAAC,UAAgB,kBAAN,GAAW;AAAA,IAC/B,OAAO;AACL,cAAQ,IAAI,SAAS,KAAK;AAG1B,aACE,oBAAC,MAAM,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":[]}
|
|
@@ -1,15 +1,39 @@
|
|
|
1
|
-
|
|
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");
|
|
2
25
|
const FAQS = ({ faqs }) => {
|
|
3
26
|
if (!faqs) return null;
|
|
4
|
-
return /* @__PURE__ */ jsxs("div", { children: [
|
|
5
|
-
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold mb-2", children: "FAQS" }),
|
|
6
|
-
/* @__PURE__ */ jsx("ul", { children: faqs.map((faq) => /* @__PURE__ */ jsxs("li", { children: [
|
|
7
|
-
/* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold mb-2", children: faq.question }),
|
|
8
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-gray-700", children: faq.answer })
|
|
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 })
|
|
9
32
|
] }, faq.question)) })
|
|
10
33
|
] });
|
|
11
34
|
};
|
|
12
|
-
export
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
13
37
|
FAQS
|
|
14
|
-
};
|
|
38
|
+
});
|
|
15
39
|
//# sourceMappingURL=faq.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/blog-post/_components/faq.tsx"],"sourcesContent":["import { BlogPostRes } from \"../_types/blog-post\";\n\nexport const FAQS = ({ faqs }: { faqs: BlogPostRes[\"faqs\"] }) => {\n if (!faqs) return null;\n return (\n <div>\n <h2 className=\"text-lg font-semibold mb-2\">FAQS</h2>\n <ul>\n {faqs.map((faq) => (\n <li key={faq.question}>\n <h3 className=\"text-lg font-semibold mb-2\">{faq.question}</h3>\n <p className=\"text-sm text-gray-700\">{faq.answer}</p>\n </li>\n ))}\n </ul>\n </div>\n );\n};\n"],"mappings":"AAMM
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/blog-post/_components/faq.tsx"],"sourcesContent":["import { BlogPostRes } from \"../_types/blog-post\";\n\nexport const FAQS = ({ faqs }: { faqs: BlogPostRes[\"faqs\"] }) => {\n if (!faqs) return null;\n return (\n <div>\n <h2 className=\"text-lg font-semibold mb-2\">FAQS</h2>\n <ul>\n {faqs.map((faq) => (\n <li key={faq.question}>\n <h3 className=\"text-lg font-semibold mb-2\">{faq.question}</h3>\n <p className=\"text-sm text-gray-700\">{faq.answer}</p>\n </li>\n ))}\n </ul>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMM;AAJC,MAAM,OAAO,CAAC,EAAE,KAAK,MAAqC;AAC/D,MAAI,CAAC,KAAM,QAAO;AAClB,SACE,6CAAC,SACC;AAAA,gDAAC,QAAG,WAAU,8BAA6B,kBAAI;AAAA,IAC/C,4CAAC,QACE,eAAK,IAAI,CAAC,QACT,6CAAC,QACC;AAAA,kDAAC,QAAG,WAAU,8BAA8B,cAAI,UAAS;AAAA,MACzD,4CAAC,OAAE,WAAU,yBAAyB,cAAI,QAAO;AAAA,SAF1C,IAAI,QAGb,CACD,GACH;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
const FAQS = ({ faqs }) => {
|
|
3
|
+
if (!faqs) return null;
|
|
4
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
5
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold mb-2", children: "FAQS" }),
|
|
6
|
+
/* @__PURE__ */ jsx("ul", { children: faqs.map((faq) => /* @__PURE__ */ jsxs("li", { children: [
|
|
7
|
+
/* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold mb-2", children: faq.question }),
|
|
8
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-gray-700", children: faq.answer })
|
|
9
|
+
] }, faq.question)) })
|
|
10
|
+
] });
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
FAQS
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=faq.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/blog-post/_components/faq.tsx"],"sourcesContent":["import { BlogPostRes } from \"../_types/blog-post\";\n\nexport const FAQS = ({ faqs }: { faqs: BlogPostRes[\"faqs\"] }) => {\n if (!faqs) return null;\n return (\n <div>\n <h2 className=\"text-lg font-semibold mb-2\">FAQS</h2>\n <ul>\n {faqs.map((faq) => (\n <li key={faq.question}>\n <h3 className=\"text-lg font-semibold mb-2\">{faq.question}</h3>\n <p className=\"text-sm text-gray-700\">{faq.answer}</p>\n </li>\n ))}\n </ul>\n </div>\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/blog-post/_components/faq.tsx"],"sourcesContent":["import { BlogPostRes } from \"../_types/blog-post\";\n\nexport const FAQS = ({ faqs }: { faqs: BlogPostRes[\"faqs\"] }) => {\n if (!faqs) return null;\n return (\n <div>\n <h2 className=\"text-lg font-semibold mb-2\">FAQS</h2>\n <ul>\n {faqs.map((faq) => (\n <li key={faq.question}>\n <h3 className=\"text-lg font-semibold mb-2\">{faq.question}</h3>\n <p className=\"text-sm text-gray-700\">{faq.answer}</p>\n </li>\n ))}\n </ul>\n </div>\n );\n};\n"],"mappings":"AAMM,cAGI,YAHJ;AAJC,MAAM,OAAO,CAAC,EAAE,KAAK,MAAqC;AAC/D,MAAI,CAAC,KAAM,QAAO;AAClB,SACE,qBAAC,SACC;AAAA,wBAAC,QAAG,WAAU,8BAA6B,kBAAI;AAAA,IAC/C,oBAAC,QACE,eAAK,IAAI,CAAC,QACT,qBAAC,QACC;AAAA,0BAAC,QAAG,WAAU,8BAA8B,cAAI,UAAS;AAAA,MACzD,oBAAC,OAAE,WAAU,yBAAyB,cAAI,QAAO;AAAA,SAF1C,IAAI,QAGb,CACD,GACH;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -1,25 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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");
|
|
5
38
|
const Share = ({ post }) => {
|
|
6
|
-
const postUrl = encodeURIComponent(`${opinlyConfig.blogUrl}/${post.slug}`);
|
|
7
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex gap-2 mb-6", children: [
|
|
8
|
-
/* @__PURE__ */ jsxs(
|
|
9
|
-
|
|
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,
|
|
10
43
|
{
|
|
11
44
|
href: `https://linkedin.com/sharing/share-offsite?url=${postUrl}`,
|
|
12
45
|
target: "_blank",
|
|
13
46
|
rel: "noopener noreferrer",
|
|
14
47
|
className: "border p-1 rounded flex items-center justify-center w-8 h-8",
|
|
15
48
|
children: [
|
|
16
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Share on LinkedIn" }),
|
|
17
|
-
/* @__PURE__ */ jsx(Linkedin, { className: "w-4 h-4" })
|
|
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" })
|
|
18
51
|
]
|
|
19
52
|
}
|
|
20
53
|
),
|
|
21
|
-
/* @__PURE__ */ jsxs(
|
|
22
|
-
|
|
54
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
55
|
+
import_link.default,
|
|
23
56
|
{
|
|
24
57
|
href: `https://twitter.com/intent/tweet?url=${postUrl}&text=${encodeURIComponent(
|
|
25
58
|
`Check out this article by ${post.author?.name}`
|
|
@@ -28,39 +61,40 @@ const Share = ({ post }) => {
|
|
|
28
61
|
rel: "noopener noreferrer",
|
|
29
62
|
className: "border p-1 rounded flex items-center justify-center w-8 h-8",
|
|
30
63
|
children: [
|
|
31
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Share on Twitter" }),
|
|
32
|
-
/* @__PURE__ */ jsx(Twitter, {})
|
|
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, {})
|
|
33
66
|
]
|
|
34
67
|
}
|
|
35
68
|
),
|
|
36
|
-
/* @__PURE__ */ jsxs(
|
|
37
|
-
|
|
69
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
70
|
+
import_link.default,
|
|
38
71
|
{
|
|
39
72
|
href: `https://facebook.com/sharer/sharer.php?u=${postUrl}`,
|
|
40
73
|
target: "_blank",
|
|
41
74
|
rel: "noopener noreferrer",
|
|
42
75
|
className: "border p-1 rounded flex items-center justify-center w-8 h-8",
|
|
43
76
|
children: [
|
|
44
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Share on Facebook" }),
|
|
45
|
-
/* @__PURE__ */ jsx(Facebook, {})
|
|
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, {})
|
|
46
79
|
]
|
|
47
80
|
}
|
|
48
81
|
),
|
|
49
|
-
/* @__PURE__ */ jsxs(
|
|
50
|
-
|
|
82
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
83
|
+
import_link.default,
|
|
51
84
|
{
|
|
52
85
|
href: `mailto:?body=${encodeURIComponent(`${post.title}
|
|
53
86
|
${postUrl}`)}`,
|
|
54
87
|
className: "border p-1 rounded flex items-center justify-center w-8 h-8",
|
|
55
88
|
children: [
|
|
56
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Share via Email" }),
|
|
57
|
-
/* @__PURE__ */ jsx(Mail, { className: "w-4 h-4" })
|
|
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" })
|
|
58
91
|
]
|
|
59
92
|
}
|
|
60
93
|
)
|
|
61
94
|
] });
|
|
62
95
|
};
|
|
63
|
-
export
|
|
96
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
97
|
+
0 && (module.exports = {
|
|
64
98
|
Share
|
|
65
|
-
};
|
|
99
|
+
});
|
|
66
100
|
//# sourceMappingURL=share.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/blog-post/_components/share.tsx"],"sourcesContent":["import { Facebook, Linkedin, Mail, Twitter } from \"lucide-react\";\nimport Link from \"next/link\";\nimport { opinlyConfig } from \"../../../utils/sdk-config\";\nimport { BlogPostRes } from \"../_types/blog-post\";\n\nexport const Share = ({ post }: { post: BlogPostRes }) => {\n const postUrl = encodeURIComponent(`${opinlyConfig.blogUrl}/${post.slug}`);\n return (\n <div className=\"flex gap-2 mb-6\">\n <Link\n href={`https://linkedin.com/sharing/share-offsite?url=${postUrl}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"border p-1 rounded flex items-center justify-center w-8 h-8\"\n >\n <span className=\"sr-only\">Share on LinkedIn</span>\n <Linkedin className=\"w-4 h-4\" />\n </Link>\n <Link\n href={`https://twitter.com/intent/tweet?url=${postUrl}&text=${encodeURIComponent(\n `Check out this article by ${post.author?.name}`\n )}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"border p-1 rounded flex items-center justify-center w-8 h-8\"\n >\n <span className=\"sr-only\">Share on Twitter</span>\n <Twitter />\n </Link>\n <Link\n href={`https://facebook.com/sharer/sharer.php?u=${postUrl}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"border p-1 rounded flex items-center justify-center w-8 h-8\"\n >\n <span className=\"sr-only\">Share on Facebook</span>\n <Facebook />\n </Link>\n <Link\n href={`mailto:?body=${encodeURIComponent(`${post.title}\\n${postUrl}`)}`}\n className=\"border p-1 rounded flex items-center justify-center w-8 h-8\"\n >\n <span className=\"sr-only\">Share via Email</span>\n <Mail className=\"w-4 h-4\" />\n </Link>\n </div>\n );\n};\n"],"mappings":"AASM
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/blog-post/_components/share.tsx"],"sourcesContent":["import { Facebook, Linkedin, Mail, Twitter } from \"lucide-react\";\nimport Link from \"next/link\";\nimport { opinlyConfig } from \"../../../utils/sdk-config\";\nimport { BlogPostRes } from \"../_types/blog-post\";\n\nexport const Share = ({ post }: { post: BlogPostRes }) => {\n const postUrl = encodeURIComponent(`${opinlyConfig.blogUrl}/${post.slug}`);\n return (\n <div className=\"flex gap-2 mb-6\">\n <Link\n href={`https://linkedin.com/sharing/share-offsite?url=${postUrl}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"border p-1 rounded flex items-center justify-center w-8 h-8\"\n >\n <span className=\"sr-only\">Share on LinkedIn</span>\n <Linkedin className=\"w-4 h-4\" />\n </Link>\n <Link\n href={`https://twitter.com/intent/tweet?url=${postUrl}&text=${encodeURIComponent(\n `Check out this article by ${post.author?.name}`\n )}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"border p-1 rounded flex items-center justify-center w-8 h-8\"\n >\n <span className=\"sr-only\">Share on Twitter</span>\n <Twitter />\n </Link>\n <Link\n href={`https://facebook.com/sharer/sharer.php?u=${postUrl}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"border p-1 rounded flex items-center justify-center w-8 h-8\"\n >\n <span className=\"sr-only\">Share on Facebook</span>\n <Facebook />\n </Link>\n <Link\n href={`mailto:?body=${encodeURIComponent(`${post.title}\\n${postUrl}`)}`}\n className=\"border p-1 rounded flex items-center justify-center w-8 h-8\"\n >\n <span className=\"sr-only\">Share via Email</span>\n <Mail className=\"w-4 h-4\" />\n </Link>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AASM;AATN,0BAAkD;AAClD,kBAAiB;AACjB,wBAA6B;AAGtB,MAAM,QAAQ,CAAC,EAAE,KAAK,MAA6B;AACxD,QAAM,UAAU,mBAAmB,GAAG,+BAAa,OAAO,IAAI,KAAK,IAAI,EAAE;AACzE,SACE,6CAAC,SAAI,WAAU,mBACb;AAAA;AAAA,MAAC,YAAAA;AAAA,MAAA;AAAA,QACC,MAAM,kDAAkD,OAAO;AAAA,QAC/D,QAAO;AAAA,QACP,KAAI;AAAA,QACJ,WAAU;AAAA,QAEV;AAAA,sDAAC,UAAK,WAAU,WAAU,+BAAiB;AAAA,UAC3C,4CAAC,gCAAS,WAAU,WAAU;AAAA;AAAA;AAAA,IAChC;AAAA,IACA;AAAA,MAAC,YAAAA;AAAA,MAAA;AAAA,QACC,MAAM,wCAAwC,OAAO,SAAS;AAAA,UAC5D,6BAA6B,KAAK,QAAQ,IAAI;AAAA,QAChD,CAAC;AAAA,QACD,QAAO;AAAA,QACP,KAAI;AAAA,QACJ,WAAU;AAAA,QAEV;AAAA,sDAAC,UAAK,WAAU,WAAU,8BAAgB;AAAA,UAC1C,4CAAC,+BAAQ;AAAA;AAAA;AAAA,IACX;AAAA,IACA;AAAA,MAAC,YAAAA;AAAA,MAAA;AAAA,QACC,MAAM,4CAA4C,OAAO;AAAA,QACzD,QAAO;AAAA,QACP,KAAI;AAAA,QACJ,WAAU;AAAA,QAEV;AAAA,sDAAC,UAAK,WAAU,WAAU,+BAAiB;AAAA,UAC3C,4CAAC,gCAAS;AAAA;AAAA;AAAA,IACZ;AAAA,IACA;AAAA,MAAC,YAAAA;AAAA,MAAA;AAAA,QACC,MAAM,gBAAgB,mBAAmB,GAAG,KAAK,KAAK;AAAA,EAAK,OAAO,EAAE,CAAC;AAAA,QACrE,WAAU;AAAA,QAEV;AAAA,sDAAC,UAAK,WAAU,WAAU,6BAAe;AAAA,UACzC,4CAAC,4BAAK,WAAU,WAAU;AAAA;AAAA;AAAA,IAC5B;AAAA,KACF;AAEJ;","names":["Link"]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Facebook, Linkedin, Mail, Twitter } from "lucide-react";
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
import { opinlyConfig } from "../../../utils/sdk-config";
|
|
5
|
+
const Share = ({ post }) => {
|
|
6
|
+
const postUrl = encodeURIComponent(`${opinlyConfig.blogUrl}/${post.slug}`);
|
|
7
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex gap-2 mb-6", children: [
|
|
8
|
+
/* @__PURE__ */ jsxs(
|
|
9
|
+
Link,
|
|
10
|
+
{
|
|
11
|
+
href: `https://linkedin.com/sharing/share-offsite?url=${postUrl}`,
|
|
12
|
+
target: "_blank",
|
|
13
|
+
rel: "noopener noreferrer",
|
|
14
|
+
className: "border p-1 rounded flex items-center justify-center w-8 h-8",
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Share on LinkedIn" }),
|
|
17
|
+
/* @__PURE__ */ jsx(Linkedin, { className: "w-4 h-4" })
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
),
|
|
21
|
+
/* @__PURE__ */ jsxs(
|
|
22
|
+
Link,
|
|
23
|
+
{
|
|
24
|
+
href: `https://twitter.com/intent/tweet?url=${postUrl}&text=${encodeURIComponent(
|
|
25
|
+
`Check out this article by ${post.author?.name}`
|
|
26
|
+
)}`,
|
|
27
|
+
target: "_blank",
|
|
28
|
+
rel: "noopener noreferrer",
|
|
29
|
+
className: "border p-1 rounded flex items-center justify-center w-8 h-8",
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Share on Twitter" }),
|
|
32
|
+
/* @__PURE__ */ jsx(Twitter, {})
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
/* @__PURE__ */ jsxs(
|
|
37
|
+
Link,
|
|
38
|
+
{
|
|
39
|
+
href: `https://facebook.com/sharer/sharer.php?u=${postUrl}`,
|
|
40
|
+
target: "_blank",
|
|
41
|
+
rel: "noopener noreferrer",
|
|
42
|
+
className: "border p-1 rounded flex items-center justify-center w-8 h-8",
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Share on Facebook" }),
|
|
45
|
+
/* @__PURE__ */ jsx(Facebook, {})
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
/* @__PURE__ */ jsxs(
|
|
50
|
+
Link,
|
|
51
|
+
{
|
|
52
|
+
href: `mailto:?body=${encodeURIComponent(`${post.title}
|
|
53
|
+
${postUrl}`)}`,
|
|
54
|
+
className: "border p-1 rounded flex items-center justify-center w-8 h-8",
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Share via Email" }),
|
|
57
|
+
/* @__PURE__ */ jsx(Mail, { className: "w-4 h-4" })
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
] });
|
|
62
|
+
};
|
|
63
|
+
export {
|
|
64
|
+
Share
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=share.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/blog-post/_components/share.tsx"],"sourcesContent":["import { Facebook, Linkedin, Mail, Twitter } from \"lucide-react\";\nimport Link from \"next/link\";\nimport { opinlyConfig } from \"../../../utils/sdk-config\";\nimport { BlogPostRes } from \"../_types/blog-post\";\n\nexport const Share = ({ post }: { post: BlogPostRes }) => {\n const postUrl = encodeURIComponent(`${opinlyConfig.blogUrl}/${post.slug}`);\n return (\n <div className=\"flex gap-2 mb-6\">\n <Link\n href={`https://linkedin.com/sharing/share-offsite?url=${postUrl}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"border p-1 rounded flex items-center justify-center w-8 h-8\"\n >\n <span className=\"sr-only\">Share on LinkedIn</span>\n <Linkedin className=\"w-4 h-4\" />\n </Link>\n <Link\n href={`https://twitter.com/intent/tweet?url=${postUrl}&text=${encodeURIComponent(\n `Check out this article by ${post.author?.name}`\n )}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"border p-1 rounded flex items-center justify-center w-8 h-8\"\n >\n <span className=\"sr-only\">Share on Twitter</span>\n <Twitter />\n </Link>\n <Link\n href={`https://facebook.com/sharer/sharer.php?u=${postUrl}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"border p-1 rounded flex items-center justify-center w-8 h-8\"\n >\n <span className=\"sr-only\">Share on Facebook</span>\n <Facebook />\n </Link>\n <Link\n href={`mailto:?body=${encodeURIComponent(`${post.title}\\n${postUrl}`)}`}\n className=\"border p-1 rounded flex items-center justify-center w-8 h-8\"\n >\n <span className=\"sr-only\">Share via Email</span>\n <Mail className=\"w-4 h-4\" />\n </Link>\n </div>\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/blog-post/_components/share.tsx"],"sourcesContent":["import { Facebook, Linkedin, Mail, Twitter } from \"lucide-react\";\nimport Link from \"next/link\";\nimport { opinlyConfig } from \"../../../utils/sdk-config\";\nimport { BlogPostRes } from \"../_types/blog-post\";\n\nexport const Share = ({ post }: { post: BlogPostRes }) => {\n const postUrl = encodeURIComponent(`${opinlyConfig.blogUrl}/${post.slug}`);\n return (\n <div className=\"flex gap-2 mb-6\">\n <Link\n href={`https://linkedin.com/sharing/share-offsite?url=${postUrl}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"border p-1 rounded flex items-center justify-center w-8 h-8\"\n >\n <span className=\"sr-only\">Share on LinkedIn</span>\n <Linkedin className=\"w-4 h-4\" />\n </Link>\n <Link\n href={`https://twitter.com/intent/tweet?url=${postUrl}&text=${encodeURIComponent(\n `Check out this article by ${post.author?.name}`\n )}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"border p-1 rounded flex items-center justify-center w-8 h-8\"\n >\n <span className=\"sr-only\">Share on Twitter</span>\n <Twitter />\n </Link>\n <Link\n href={`https://facebook.com/sharer/sharer.php?u=${postUrl}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"border p-1 rounded flex items-center justify-center w-8 h-8\"\n >\n <span className=\"sr-only\">Share on Facebook</span>\n <Facebook />\n </Link>\n <Link\n href={`mailto:?body=${encodeURIComponent(`${post.title}\\n${postUrl}`)}`}\n className=\"border p-1 rounded flex items-center justify-center w-8 h-8\"\n >\n <span className=\"sr-only\">Share via Email</span>\n <Mail className=\"w-4 h-4\" />\n </Link>\n </div>\n );\n};\n"],"mappings":"AASM,SAME,KANF;AATN,SAAS,UAAU,UAAU,MAAM,eAAe;AAClD,OAAO,UAAU;AACjB,SAAS,oBAAoB;AAGtB,MAAM,QAAQ,CAAC,EAAE,KAAK,MAA6B;AACxD,QAAM,UAAU,mBAAmB,GAAG,aAAa,OAAO,IAAI,KAAK,IAAI,EAAE;AACzE,SACE,qBAAC,SAAI,WAAU,mBACb;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,MAAM,kDAAkD,OAAO;AAAA,QAC/D,QAAO;AAAA,QACP,KAAI;AAAA,QACJ,WAAU;AAAA,QAEV;AAAA,8BAAC,UAAK,WAAU,WAAU,+BAAiB;AAAA,UAC3C,oBAAC,YAAS,WAAU,WAAU;AAAA;AAAA;AAAA,IAChC;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,MAAM,wCAAwC,OAAO,SAAS;AAAA,UAC5D,6BAA6B,KAAK,QAAQ,IAAI;AAAA,QAChD,CAAC;AAAA,QACD,QAAO;AAAA,QACP,KAAI;AAAA,QACJ,WAAU;AAAA,QAEV;AAAA,8BAAC,UAAK,WAAU,WAAU,8BAAgB;AAAA,UAC1C,oBAAC,WAAQ;AAAA;AAAA;AAAA,IACX;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,MAAM,4CAA4C,OAAO;AAAA,QACzD,QAAO;AAAA,QACP,KAAI;AAAA,QACJ,WAAU;AAAA,QAEV;AAAA,8BAAC,UAAK,WAAU,WAAU,+BAAiB;AAAA,UAC3C,oBAAC,YAAS;AAAA;AAAA;AAAA,IACZ;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,MAAM,gBAAgB,mBAAmB,GAAG,KAAK,KAAK;AAAA,EAAK,OAAO,EAAE,CAAC;AAAA,QACrE,WAAU;AAAA,QAEV;AAAA,8BAAC,UAAK,WAAU,WAAU,6BAAe;AAAA,UACzC,oBAAC,QAAK,WAAU,WAAU;AAAA;AAAA;AAAA,IAC5B;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -1,47 +1,82 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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);
|
|
8
41
|
const TableOfContents = ({
|
|
9
42
|
content,
|
|
10
43
|
author,
|
|
11
44
|
post
|
|
12
45
|
}) => {
|
|
13
|
-
return /* @__PURE__ */ jsxs("aside", { className: cn("w-full lg:w-1/3 lg:sticky lg:top-20 lg:self-start"), children: [
|
|
14
|
-
author && /* @__PURE__ */ jsx("div", { className: "w-full mb-6 border p-4 rounded-md text-sm", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 mb-3", children: [
|
|
15
|
-
author.fileKey && /* @__PURE__ */ jsx(
|
|
16
|
-
|
|
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,
|
|
17
50
|
{
|
|
18
|
-
|
|
51
|
+
unoptimized: import_sdk_config.opinlyConfig.unoptimizedImages,
|
|
52
|
+
src: `${import_sdk_config.opinlyConfig.imagesPrefix}/${author.fileKey}`,
|
|
19
53
|
alt: author.name,
|
|
20
54
|
width: 48,
|
|
21
55
|
height: 48,
|
|
22
56
|
className: "rounded-full"
|
|
23
57
|
}
|
|
24
58
|
),
|
|
25
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
26
|
-
/* @__PURE__ */ jsx(
|
|
27
|
-
|
|
59
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
60
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
61
|
+
import_link.default,
|
|
28
62
|
{
|
|
29
|
-
href: `${opinlyConfig.blogPrefix}/authors/${author.slug}`,
|
|
63
|
+
href: `${import_sdk_config.opinlyConfig.blogPrefix}/authors/${author.slug}`,
|
|
30
64
|
className: "text-xs uppercase text-muted-foreground font-medium",
|
|
31
65
|
children: author.name
|
|
32
66
|
}
|
|
33
67
|
),
|
|
34
|
-
/* @__PURE__ */ jsx("div", { className: "text-muted-foreground text-sm", children: author.bio })
|
|
68
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-muted-foreground text-sm", children: author.bio })
|
|
35
69
|
] })
|
|
36
70
|
] }) }),
|
|
37
|
-
/* @__PURE__ */ jsx(Share, { post }),
|
|
38
|
-
/* @__PURE__ */ jsxs("div", { className: "border-l-4 border-opinlyAccent pl-4 mb-4", children: [
|
|
39
|
-
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold mb-2", children: "TABLE OF CONTENTS" }),
|
|
40
|
-
/* @__PURE__ */ jsx("ul", { className: "text-sm text-gray-700 space-y-1", children: (extractHeadings(content) || []).map((heading) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", { href: `#${heading.slug}`, className: "hover:underline", children: heading.text }) }, heading.slug)) })
|
|
71
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_share.Share, { post }),
|
|
72
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "border-l-4 border-opinlyAccent pl-4 mb-4", children: [
|
|
73
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "text-lg font-semibold mb-2", children: "TABLE OF CONTENTS" }),
|
|
74
|
+
/* @__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)) })
|
|
41
75
|
] })
|
|
42
76
|
] });
|
|
43
77
|
};
|
|
44
|
-
export
|
|
78
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
79
|
+
0 && (module.exports = {
|
|
45
80
|
TableOfContents
|
|
46
|
-
};
|
|
81
|
+
});
|
|
47
82
|
//# sourceMappingURL=table-of-contents.js.map
|