@opinly/next 0.1.14 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/author-page/_helpers/json-ld.cjs +2 -0
- package/dist/components/author-page/_helpers/json-ld.js +0 -1
- package/dist/components/author-page/index.cjs +84 -0
- package/dist/components/author-page/{index.mjs.map → index.cjs.map} +1 -1
- package/dist/components/author-page/index.js +23 -57
- package/dist/components/author-page/index.js.map +1 -1
- package/dist/components/authors-page/index.cjs +105 -0
- package/dist/components/authors-page/{index.mjs.map → index.cjs.map} +1 -1
- package/dist/components/authors-page/index.js +29 -63
- package/dist/components/authors-page/index.js.map +1 -1
- package/dist/components/blog-post/_components/content.cjs +160 -0
- package/dist/components/blog-post/_components/{content.mjs.map → content.cjs.map} +1 -1
- package/dist/components/blog-post/_components/content.js +29 -63
- package/dist/components/blog-post/_components/content.js.map +1 -1
- package/dist/components/blog-post/_components/faq.cjs +39 -0
- package/dist/components/blog-post/_components/{faq.mjs.map → faq.cjs.map} +1 -1
- package/dist/components/blog-post/_components/faq.js +8 -32
- package/dist/components/blog-post/_components/faq.js.map +1 -1
- package/dist/components/blog-post/_components/share.cjs +100 -0
- package/dist/components/blog-post/_components/{share.mjs.map → share.cjs.map} +1 -1
- package/dist/components/blog-post/_components/share.js +24 -58
- package/dist/components/blog-post/_components/share.js.map +1 -1
- package/dist/components/blog-post/_components/table-of-contents.cjs +82 -0
- package/dist/components/blog-post/_components/{table-of-contents.mjs.map → table-of-contents.cjs.map} +1 -1
- package/dist/components/blog-post/_components/table-of-contents.js +24 -58
- package/dist/components/blog-post/_components/table-of-contents.js.map +1 -1
- package/dist/components/blog-post/_helpers/calc-reading-time.cjs +2 -0
- package/dist/components/blog-post/_helpers/calc-reading-time.js +0 -1
- package/dist/components/blog-post/_helpers/extract-headings.cjs +44 -0
- package/dist/components/blog-post/_helpers/{extract-headings.mjs.map → extract-headings.cjs.map} +1 -1
- package/dist/components/blog-post/_helpers/extract-headings.js +2 -26
- package/dist/components/blog-post/_helpers/extract-headings.js.map +1 -1
- package/dist/components/blog-post/_helpers/{json-ld.mjs → json-ld.cjs} +39 -12
- package/dist/components/blog-post/_helpers/{json-ld.mjs.map → json-ld.cjs.map} +1 -1
- package/dist/components/blog-post/_helpers/json-ld.js +11 -38
- package/dist/components/blog-post/_helpers/json-ld.js.map +1 -1
- package/dist/components/blog-post/_helpers/reading-time.cjs +50 -0
- package/dist/components/blog-post/_helpers/{reading-time.mjs.map → reading-time.cjs.map} +1 -1
- package/dist/components/blog-post/_helpers/reading-time.js +2 -27
- package/dist/components/blog-post/_helpers/reading-time.js.map +1 -1
- package/dist/components/blog-post/_types/blog-post.cjs +17 -0
- package/dist/components/blog-post/_types/blog-post.cjs.map +1 -0
- package/dist/components/blog-post/_types/blog-post.js +0 -16
- package/dist/components/blog-post/_types/blog-post.js.map +1 -1
- package/dist/components/blog-post/_types/class-names.cjs +17 -0
- package/dist/components/blog-post/_types/class-names.cjs.map +1 -0
- package/dist/components/blog-post/_types/class-names.js +0 -16
- package/dist/components/blog-post/_types/class-names.js.map +1 -1
- package/dist/components/blog-post/index.cjs +148 -0
- package/dist/components/blog-post/{index.mjs.map → index.cjs.map} +1 -1
- package/dist/components/blog-post/index.js +47 -77
- package/dist/components/blog-post/index.js.map +1 -1
- package/dist/components/bread-crumbs.cjs +60 -0
- package/dist/components/{bread-crumbs.mjs.map → bread-crumbs.cjs.map} +1 -1
- package/dist/components/bread-crumbs.js +13 -47
- package/dist/components/bread-crumbs.js.map +1 -1
- package/dist/components/folder-page/index.cjs +61 -0
- package/dist/components/folder-page/{index.mjs.map → index.cjs.map} +1 -1
- package/dist/components/folder-page/index.js +12 -36
- package/dist/components/folder-page/index.js.map +1 -1
- package/dist/components/home-page/folders.cjs +98 -0
- package/dist/components/home-page/{folders.mjs.map → folders.cjs.map} +1 -1
- package/dist/components/home-page/folders.js +29 -64
- package/dist/components/home-page/folders.js.map +1 -1
- package/dist/components/home-page/index.cjs +44 -0
- package/dist/components/home-page/{index.mjs.map → index.cjs.map} +1 -1
- package/dist/components/home-page/index.js +11 -35
- package/dist/components/home-page/index.js.map +1 -1
- package/dist/components/home-page/pagination.cjs +91 -0
- package/dist/components/home-page/{pagination.mjs.map → pagination.cjs.map} +1 -1
- package/dist/components/home-page/pagination.js +9 -43
- package/dist/components/home-page/pagination.js.map +1 -1
- package/dist/components/home-page/top-posts.cjs +52 -0
- package/dist/components/home-page/{top-posts.mjs.map → top-posts.cjs.map} +1 -1
- package/dist/components/home-page/top-posts.js +10 -34
- package/dist/components/home-page/top-posts.js.map +1 -1
- package/dist/components/not-found.cjs +60 -0
- package/dist/components/{not-found.mjs.map → not-found.cjs.map} +1 -1
- package/dist/components/not-found.js +15 -49
- package/dist/components/not-found.js.map +1 -1
- package/dist/components/opinly-blog.cjs +57 -0
- package/dist/components/{opinly-blog.mjs.map → opinly-blog.cjs.map} +1 -1
- package/dist/components/opinly-blog.js +15 -39
- package/dist/components/opinly-blog.js.map +1 -1
- package/dist/components/post-preview.cjs +112 -0
- package/dist/components/{post-preview.mjs.map → post-preview.cjs.map} +1 -1
- package/dist/components/post-preview.js +42 -77
- package/dist/components/post-preview.js.map +1 -1
- package/dist/index.cjs +23 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +1 -22
- package/dist/index.js.map +1 -1
- package/dist/utils/dates.cjs +33 -0
- package/dist/utils/{dates.mjs.map → dates.cjs.map} +1 -1
- package/dist/utils/dates.js +2 -26
- package/dist/utils/dates.js.map +1 -1
- package/dist/utils/generate-metadata.cjs +62 -0
- package/dist/utils/generate-metadata.cjs.map +1 -0
- package/dist/utils/generate-metadata.js +9 -31
- package/dist/utils/generate-metadata.js.map +1 -1
- package/dist/utils/merge.cjs +33 -0
- package/dist/utils/{merge.mjs.map → merge.cjs.map} +1 -1
- package/dist/utils/merge.js +5 -29
- package/dist/utils/merge.js.map +1 -1
- package/dist/utils/{sdk-config.mjs → sdk-config.cjs} +28 -3
- package/dist/utils/{sdk-config.mjs.map → sdk-config.cjs.map} +1 -1
- package/dist/utils/sdk-config.js +2 -27
- package/dist/utils/sdk-config.js.map +1 -1
- package/package.json +2 -2
- package/dist/components/author-page/_helpers/json-ld.mjs +0 -1
- package/dist/components/author-page/index.mjs +0 -50
- package/dist/components/authors-page/index.mjs +0 -71
- package/dist/components/blog-post/_components/content.mjs +0 -126
- package/dist/components/blog-post/_components/faq.mjs +0 -15
- package/dist/components/blog-post/_components/share.mjs +0 -66
- package/dist/components/blog-post/_components/table-of-contents.mjs +0 -48
- package/dist/components/blog-post/_helpers/calc-reading-time.mjs +0 -1
- package/dist/components/blog-post/_helpers/extract-headings.mjs +0 -20
- package/dist/components/blog-post/_helpers/reading-time.mjs +0 -25
- package/dist/components/blog-post/_types/blog-post.mjs +0 -1
- package/dist/components/blog-post/_types/blog-post.mjs.map +0 -1
- package/dist/components/blog-post/_types/class-names.mjs +0 -1
- package/dist/components/blog-post/_types/class-names.mjs.map +0 -1
- package/dist/components/blog-post/index.mjs +0 -118
- package/dist/components/bread-crumbs.mjs +0 -26
- package/dist/components/folder-page/index.mjs +0 -37
- package/dist/components/home-page/folders.mjs +0 -63
- package/dist/components/home-page/index.mjs +0 -20
- package/dist/components/home-page/pagination.mjs +0 -57
- package/dist/components/home-page/top-posts.mjs +0 -28
- package/dist/components/not-found.mjs +0 -26
- package/dist/components/opinly-blog.mjs +0 -33
- package/dist/components/post-preview.mjs +0 -77
- package/dist/index.mjs +0 -2
- package/dist/index.mjs.map +0 -1
- package/dist/utils/dates.mjs +0 -9
- package/dist/utils/generate-metadata.mjs +0 -36
- package/dist/utils/generate-metadata.mjs.map +0 -1
- package/dist/utils/merge.mjs +0 -9
- /package/dist/components/author-page/_helpers/{json-ld.mjs.map → json-ld.cjs.map} +0 -0
- /package/dist/components/blog-post/_helpers/{calc-reading-time.mjs.map → calc-reading-time.cjs.map} +0 -0
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { PostPreview } from "../post-preview";
|
|
3
|
-
import { BreadCrumbs } from "../bread-crumbs";
|
|
4
|
-
const FolderPage = ({
|
|
5
|
-
folder
|
|
6
|
-
}) => {
|
|
7
|
-
console.log("folder", JSON.stringify(folder, null, 2));
|
|
8
|
-
return /* @__PURE__ */ jsxs("div", { className: "max-w-6xl mx-auto px-4 py-10", children: [
|
|
9
|
-
/* @__PURE__ */ jsx(BreadCrumbs, {}),
|
|
10
|
-
/* @__PURE__ */ jsx("h1", { className: "text-4xl font-bold mb-2", children: folder.name }),
|
|
11
|
-
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground max-w-2xl mb-8", children: folder.description || `Explore articles about ${folder.name}.` }),
|
|
12
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8", children: [
|
|
13
|
-
folder.posts.length === 0 && /* @__PURE__ */ jsx("div", { className: "text-muted-foreground", children: "No posts added yet" }),
|
|
14
|
-
folder.posts.map((post) => {
|
|
15
|
-
console.log("post.image", post.image);
|
|
16
|
-
return /* @__PURE__ */ jsx(PostPreview, { post }, post.slug);
|
|
17
|
-
})
|
|
18
|
-
] })
|
|
19
|
-
] });
|
|
20
|
-
};
|
|
21
|
-
function formatDate(dateStr) {
|
|
22
|
-
return new Date(dateStr).toLocaleDateString("en-GB", {
|
|
23
|
-
day: "2-digit",
|
|
24
|
-
month: "short",
|
|
25
|
-
year: "numeric"
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
function formatMinutes(description) {
|
|
29
|
-
if (!description) return "5 min read";
|
|
30
|
-
const words = description.split(" ").length;
|
|
31
|
-
const mins = Math.ceil(words / 200);
|
|
32
|
-
return `${mins} min read`;
|
|
33
|
-
}
|
|
34
|
-
export {
|
|
35
|
-
FolderPage
|
|
36
|
-
};
|
|
37
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import Link from "next/link";
|
|
3
|
-
import { PostPreview } from "../post-preview";
|
|
4
|
-
import { ArrowRight } from "lucide-react";
|
|
5
|
-
import { Suspense } from "react";
|
|
6
|
-
const HomePageFoldersSkeleton = () => {
|
|
7
|
-
return /* @__PURE__ */ jsx(Fragment, { children: Array(2).fill(null).map((_, sectionIdx) => /* @__PURE__ */ jsxs("div", { className: "space-y-4 mb-5", children: [
|
|
8
|
-
/* @__PURE__ */ jsxs("div", { className: "animate-pulse space-y-2", children: [
|
|
9
|
-
/* @__PURE__ */ jsx("div", { className: "h-8 w-1/3 bg-gray-200 dark:bg-gray-700 rounded" }),
|
|
10
|
-
/* @__PURE__ */ jsx("div", { className: "h-4 w-1/2 bg-gray-200 dark:bg-gray-700 rounded" })
|
|
11
|
-
] }),
|
|
12
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-10", children: [
|
|
13
|
-
Array(3).fill(null).map((__, postIdx) => /* @__PURE__ */ jsxs("div", { className: "animate-pulse space-y-3", children: [
|
|
14
|
-
/* @__PURE__ */ jsx("div", { className: "w-full h-48 bg-gray-200 dark:bg-gray-700 rounded-lg" }),
|
|
15
|
-
/* @__PURE__ */ jsx("div", { className: "h-5 w-3/4 bg-gray-200 dark:bg-gray-700 rounded" }),
|
|
16
|
-
/* @__PURE__ */ jsx("div", { className: "h-4 w-full bg-gray-200 dark:bg-gray-700 rounded" })
|
|
17
|
-
] }, postIdx)),
|
|
18
|
-
/* @__PURE__ */ jsx("div", { className: "flex justify-center items-center animate-pulse", children: /* @__PURE__ */ jsx("div", { className: "h-4 w-48 bg-gray-200 dark:bg-gray-700 rounded" }) })
|
|
19
|
-
] })
|
|
20
|
-
] }, sectionIdx)) });
|
|
21
|
-
};
|
|
22
|
-
const HomePageFoldersServer = async ({ client }) => {
|
|
23
|
-
const folders = await client.client.content.homePageFolders.query();
|
|
24
|
-
return /* @__PURE__ */ jsx(Fragment, { children: folders.map((folder) => /* @__PURE__ */ jsxs("div", { className: "space-y-4 ", children: [
|
|
25
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 mb-20", children: [
|
|
26
|
-
/* @__PURE__ */ jsx(
|
|
27
|
-
Link,
|
|
28
|
-
{
|
|
29
|
-
href: `/blog/${folder.slug}`,
|
|
30
|
-
className: "text-3xl",
|
|
31
|
-
children: folder.title
|
|
32
|
-
},
|
|
33
|
-
folder.slug
|
|
34
|
-
),
|
|
35
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: folder.description })
|
|
36
|
-
] }),
|
|
37
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-10 mb-20", children: [
|
|
38
|
-
folder.posts.filter((post) => post !== null).map((post) => /* @__PURE__ */ jsx(PostPreview, { post }, post.slug)),
|
|
39
|
-
/* @__PURE__ */ jsx("div", { className: "flex justify-center w-full h-full items-center ", children: /* @__PURE__ */ jsxs(
|
|
40
|
-
Link,
|
|
41
|
-
{
|
|
42
|
-
href: `/blog/${folder.slug}`,
|
|
43
|
-
className: "flex items-center gap-2",
|
|
44
|
-
children: [
|
|
45
|
-
/* @__PURE__ */ jsxs("span", { children: [
|
|
46
|
-
"View all posts in ",
|
|
47
|
-
folder.title
|
|
48
|
-
] }),
|
|
49
|
-
/* @__PURE__ */ jsx(ArrowRight, { className: "w-4 h-4" })
|
|
50
|
-
]
|
|
51
|
-
}
|
|
52
|
-
) })
|
|
53
|
-
] })
|
|
54
|
-
] })) });
|
|
55
|
-
};
|
|
56
|
-
const HomePageFolders = ({ client }) => {
|
|
57
|
-
return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(HomePageFoldersSkeleton, {}), children: /* @__PURE__ */ jsx(HomePageFoldersServer, { client }) });
|
|
58
|
-
};
|
|
59
|
-
export {
|
|
60
|
-
HomePageFolders,
|
|
61
|
-
HomePageFoldersSkeleton
|
|
62
|
-
};
|
|
63
|
-
//# sourceMappingURL=folders.mjs.map
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Suspense } from "react";
|
|
3
|
-
import { TopPosts } from "./top-posts";
|
|
4
|
-
import { HomePageFolders } from "./folders";
|
|
5
|
-
import { HomePagePagination } from "./pagination";
|
|
6
|
-
const HomePage = ({
|
|
7
|
-
searchParams,
|
|
8
|
-
client
|
|
9
|
-
}) => {
|
|
10
|
-
const parsedPage = searchParams.page ? parseInt(searchParams.page) : 1;
|
|
11
|
-
return /* @__PURE__ */ jsxs("div", { className: "max-w-7xl mx-auto px-4 py-10", children: [
|
|
12
|
-
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-10", children: /* @__PURE__ */ jsx(TopPosts, { client, page: parsedPage }) }),
|
|
13
|
-
/* @__PURE__ */ jsx("div", { className: "flex justify-center items-center mt-10 gap-2", children: /* @__PURE__ */ jsx(HomePagePagination, { client, page: parsedPage }) }),
|
|
14
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-10 mt-20", children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(HomePageFolders, { client }) }) })
|
|
15
|
-
] });
|
|
16
|
-
};
|
|
17
|
-
export {
|
|
18
|
-
HomePage
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import Link from "next/link";
|
|
3
|
-
import { cn } from "../../utils/merge";
|
|
4
|
-
const HomePagePagination = async ({
|
|
5
|
-
client,
|
|
6
|
-
page
|
|
7
|
-
}) => {
|
|
8
|
-
const count = await client.client.content.postsCount.query();
|
|
9
|
-
const totalPages = Math.ceil(count / 9);
|
|
10
|
-
const pages = [];
|
|
11
|
-
if (totalPages <= 5) {
|
|
12
|
-
for (let i = 1; i <= totalPages; i++) {
|
|
13
|
-
pages.push(i);
|
|
14
|
-
}
|
|
15
|
-
} else {
|
|
16
|
-
let start, end;
|
|
17
|
-
if (page <= 3) {
|
|
18
|
-
start = 1;
|
|
19
|
-
end = 5;
|
|
20
|
-
} else if (page >= totalPages - 2) {
|
|
21
|
-
start = totalPages - 4;
|
|
22
|
-
end = totalPages;
|
|
23
|
-
} else {
|
|
24
|
-
start = page - 2;
|
|
25
|
-
end = page + 2;
|
|
26
|
-
}
|
|
27
|
-
if (start > 1) {
|
|
28
|
-
pages.push(1);
|
|
29
|
-
if (start > 2) pages.push("ellipsis");
|
|
30
|
-
}
|
|
31
|
-
for (let i = start; i <= end; i++) {
|
|
32
|
-
pages.push(i);
|
|
33
|
-
}
|
|
34
|
-
if (end < totalPages) {
|
|
35
|
-
if (end < totalPages - 1) pages.push("ellipsis");
|
|
36
|
-
pages.push(totalPages);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return /* @__PURE__ */ jsx("nav", { "aria-label": "Pagination", children: /* @__PURE__ */ jsx("div", { className: "flex items-center space-x-1", children: pages.map(
|
|
40
|
-
(p, idx) => p === "ellipsis" ? /* @__PURE__ */ jsx("span", { className: "px-2", children: "\u2026" }, `el-${idx}`) : /* @__PURE__ */ jsx(
|
|
41
|
-
Link,
|
|
42
|
-
{
|
|
43
|
-
href: `?page=${p}`,
|
|
44
|
-
className: cn(
|
|
45
|
-
"w-10 h-10 flex items-center justify-center rounded-md",
|
|
46
|
-
page === p ? "bg-primary text-white bg-black" : "border border-gray-200 dark:border-gray-700"
|
|
47
|
-
),
|
|
48
|
-
children: p
|
|
49
|
-
},
|
|
50
|
-
p
|
|
51
|
-
)
|
|
52
|
-
) }) });
|
|
53
|
-
};
|
|
54
|
-
export {
|
|
55
|
-
HomePagePagination
|
|
56
|
-
};
|
|
57
|
-
//# sourceMappingURL=pagination.mjs.map
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { PostPreview, PostPreviewSkeleton } from "../post-preview";
|
|
3
|
-
import { Suspense } from "react";
|
|
4
|
-
const TopPostsServer = async ({
|
|
5
|
-
client,
|
|
6
|
-
page
|
|
7
|
-
}) => {
|
|
8
|
-
const posts = await client.client.content.paginatedPosts.query({
|
|
9
|
-
page
|
|
10
|
-
});
|
|
11
|
-
return /* @__PURE__ */ jsx(Fragment, { children: posts.map((post) => /* @__PURE__ */ jsx(PostPreview, { post }, "top-posts-" + post.slug)) });
|
|
12
|
-
};
|
|
13
|
-
const TopPosts = ({
|
|
14
|
-
client,
|
|
15
|
-
page
|
|
16
|
-
}) => {
|
|
17
|
-
return /* @__PURE__ */ jsx(
|
|
18
|
-
Suspense,
|
|
19
|
-
{
|
|
20
|
-
fallback: Array.from({ length: 9 }).map((_, i) => /* @__PURE__ */ jsx(PostPreviewSkeleton, {}, i)),
|
|
21
|
-
children: /* @__PURE__ */ jsx(TopPostsServer, { client, page })
|
|
22
|
-
}
|
|
23
|
-
);
|
|
24
|
-
};
|
|
25
|
-
export {
|
|
26
|
-
TopPosts
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=top-posts.mjs.map
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import Link from "next/link";
|
|
3
|
-
const OpinlyNotFound = () => {
|
|
4
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5
|
-
/* @__PURE__ */ jsx("div", { className: "bg-orange-600 py-10", children: /* @__PURE__ */ jsxs("div", { className: "max-w-7xl mx-auto px-4", children: [
|
|
6
|
-
/* @__PURE__ */ jsx("h1", { className: "text-4xl font-bold mb-2 leading-tight text-white", children: "Post Not Found" }),
|
|
7
|
-
/* @__PURE__ */ jsx("div", { className: "text-sm mb-4 text-orange-100", children: "The post you're looking for doesn't exist or has been removed." })
|
|
8
|
-
] }) }),
|
|
9
|
-
/* @__PURE__ */ jsx("div", { className: "flex max-w-7xl mx-auto mt-10 gap-12", children: /* @__PURE__ */ jsx("article", { className: "w-2/3", children: /* @__PURE__ */ jsxs("div", { className: "prose max-w-none", children: [
|
|
10
|
-
/* @__PURE__ */ jsx("p", { className: "text-gray-600", children: "You can try:" }),
|
|
11
|
-
/* @__PURE__ */ jsxs("ul", { className: "list-disc pl-6 my-4", children: [
|
|
12
|
-
/* @__PURE__ */ jsx("li", { children: "Checking the URL for typos" }),
|
|
13
|
-
/* @__PURE__ */ jsxs("li", { children: [
|
|
14
|
-
"Returning to the",
|
|
15
|
-
" ",
|
|
16
|
-
/* @__PURE__ */ jsx(Link, { href: "/blog", className: "text-blue-600 underline", children: "blog homepage" })
|
|
17
|
-
] }),
|
|
18
|
-
/* @__PURE__ */ jsx("li", { children: "Using the search function to find what you're looking for" })
|
|
19
|
-
] })
|
|
20
|
-
] }) }) })
|
|
21
|
-
] });
|
|
22
|
-
};
|
|
23
|
-
export {
|
|
24
|
-
OpinlyNotFound
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=not-found.mjs.map
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { BlogPost } from "./blog-post";
|
|
3
|
-
import { FolderPage } from "./folder-page";
|
|
4
|
-
import { HomePage } from "./home-page";
|
|
5
|
-
import { AuthorPage } from "./author-page";
|
|
6
|
-
import { OpinlyNotFound } from "./not-found";
|
|
7
|
-
import { AuthorsPage } from "./authors-page";
|
|
8
|
-
const OpinlyBlog = ({
|
|
9
|
-
blog,
|
|
10
|
-
searchParams,
|
|
11
|
-
client
|
|
12
|
-
}) => {
|
|
13
|
-
if (blog.type === "not-found") {
|
|
14
|
-
return /* @__PURE__ */ jsx(OpinlyNotFound, {});
|
|
15
|
-
}
|
|
16
|
-
if (blog.type === "home") {
|
|
17
|
-
return /* @__PURE__ */ jsx(HomePage, { searchParams, client });
|
|
18
|
-
}
|
|
19
|
-
if (blog.type === "post") {
|
|
20
|
-
return /* @__PURE__ */ jsx(BlogPost, { post: blog.data });
|
|
21
|
-
}
|
|
22
|
-
if (blog.type === "author") {
|
|
23
|
-
return /* @__PURE__ */ jsx(AuthorPage, { author: blog.data });
|
|
24
|
-
}
|
|
25
|
-
if (blog.type === "authors") {
|
|
26
|
-
return /* @__PURE__ */ jsx(AuthorsPage, { authors: blog.data });
|
|
27
|
-
}
|
|
28
|
-
return /* @__PURE__ */ jsx(FolderPage, { folder: blog.data });
|
|
29
|
-
};
|
|
30
|
-
export {
|
|
31
|
-
OpinlyBlog
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=opinly-blog.mjs.map
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import Link from "next/link";
|
|
3
|
-
import Image from "next/image";
|
|
4
|
-
import { opinlyConfig } from "../utils/sdk-config";
|
|
5
|
-
import { formatDate } from "../utils/dates";
|
|
6
|
-
const PostPreviewSkeleton = () => /* @__PURE__ */ jsxs("div", { className: "w-full h-full ", children: [
|
|
7
|
-
/* @__PURE__ */ jsx("div", { className: "animate-pulse mb-5", children: /* @__PURE__ */ jsx("div", { className: "w-full h-48 bg-gray-200 dark:bg-gray-700 rounded-lg" }) }),
|
|
8
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2 text-sm text-muted-foreground mb-3", children: [
|
|
9
|
-
/* @__PURE__ */ jsx("div", { className: "animate-pulse h-4 w-20 bg-gray-200 dark:bg-gray-700 rounded" }),
|
|
10
|
-
/* @__PURE__ */ jsx("div", { className: "animate-pulse h-4 w-1 bg-gray-200 dark:bg-gray-700 rounded-full" }),
|
|
11
|
-
/* @__PURE__ */ jsx("div", { className: "animate-pulse h-4 w-16 bg-gray-200 dark:bg-gray-700 rounded" })
|
|
12
|
-
] }),
|
|
13
|
-
/* @__PURE__ */ jsx("div", { className: "animate-pulse h-5 w-3/4 bg-gray-200 dark:bg-gray-700 rounded mb-2" }),
|
|
14
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-1 mt-1 pr-4", children: [
|
|
15
|
-
/* @__PURE__ */ jsx("div", { className: "animate-pulse h-4 w-full bg-gray-200 dark:bg-gray-700 rounded" }),
|
|
16
|
-
/* @__PURE__ */ jsx("div", { className: "animate-pulse h-4 w-10/12 bg-gray-200 dark:bg-gray-700 rounded" })
|
|
17
|
-
] }),
|
|
18
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2 text-xs text-gray-500 mt-2", children: [
|
|
19
|
-
/* @__PURE__ */ jsx("div", { className: "animate-pulse h-3 w-24 bg-gray-200 dark:bg-gray-700 rounded" }),
|
|
20
|
-
/* @__PURE__ */ jsx("div", { className: "animate-pulse h-3 w-12 bg-gray-200 dark:bg-gray-700 rounded" })
|
|
21
|
-
] })
|
|
22
|
-
] });
|
|
23
|
-
const PostPreview = ({
|
|
24
|
-
post
|
|
25
|
-
}) => {
|
|
26
|
-
const postSlug = `${opinlyConfig.blogPrefix}/${post.folder?.slug ? `${post.folder.slug}/` : ""}${post.slug}`;
|
|
27
|
-
return /* @__PURE__ */ jsxs("div", { className: "w-full h-full ", children: [
|
|
28
|
-
post.image?.fileKey && /* @__PURE__ */ jsx(Link, { href: postSlug, className: "group", children: /* @__PURE__ */ jsx("div", { className: "relative w-full h-48 mb-4", children: /* @__PURE__ */ jsx(
|
|
29
|
-
Image,
|
|
30
|
-
{
|
|
31
|
-
unoptimized: opinlyConfig.unoptimizedImages,
|
|
32
|
-
src: `${opinlyConfig.imagesPrefix}/${post.image.fileKey}`,
|
|
33
|
-
alt: post.title,
|
|
34
|
-
fill: true,
|
|
35
|
-
className: "object-cover rounded-lg"
|
|
36
|
-
}
|
|
37
|
-
) }) }),
|
|
38
|
-
/* @__PURE__ */ jsxs("div", { className: "text-sm text-muted-foreground mb-1", children: [
|
|
39
|
-
post.folder?.name && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
40
|
-
/* @__PURE__ */ jsx(
|
|
41
|
-
Link,
|
|
42
|
-
{
|
|
43
|
-
href: `${opinlyConfig.blogPrefix}/${post.folder.slug}`,
|
|
44
|
-
className: "hover:underline",
|
|
45
|
-
children: post.folder.name
|
|
46
|
-
}
|
|
47
|
-
),
|
|
48
|
-
/* @__PURE__ */ jsx("span", { className: "mx-1", children: "\xB7" })
|
|
49
|
-
] }),
|
|
50
|
-
" ",
|
|
51
|
-
formatDate(post.firstPublishedAt)
|
|
52
|
-
] }),
|
|
53
|
-
/* @__PURE__ */ jsx(Link, { href: postSlug, className: "group", children: /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold leading-snug group-hover:underline", children: post.title }) }),
|
|
54
|
-
post.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600 mt-1 line-clamp-2", children: post.description }),
|
|
55
|
-
/* @__PURE__ */ jsxs("div", { className: "text-xs text-gray-500 mt-2", children: [
|
|
56
|
-
post.author && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
57
|
-
/* @__PURE__ */ jsx(
|
|
58
|
-
Link,
|
|
59
|
-
{
|
|
60
|
-
href: `${opinlyConfig.blogPrefix}/authors/${post.author.slug}`,
|
|
61
|
-
className: "font-medium hover:underline",
|
|
62
|
-
children: post.author?.name
|
|
63
|
-
}
|
|
64
|
-
),
|
|
65
|
-
" ",
|
|
66
|
-
/* @__PURE__ */ jsx("span", { className: "mx-1", children: "\xB7" })
|
|
67
|
-
] }),
|
|
68
|
-
" ",
|
|
69
|
-
formatDate(post.firstPublishedAt)
|
|
70
|
-
] })
|
|
71
|
-
] });
|
|
72
|
-
};
|
|
73
|
-
export {
|
|
74
|
-
PostPreview,
|
|
75
|
-
PostPreviewSkeleton
|
|
76
|
-
};
|
|
77
|
-
//# sourceMappingURL=post-preview.mjs.map
|
package/dist/index.mjs
DELETED
package/dist/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from \"./components/opinly-blog\";\n"],"mappings":"AAAA,cAAc;","names":[]}
|
package/dist/utils/dates.mjs
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { opinlyConfig } from "./sdk-config";
|
|
2
|
-
const generateOpinlyMetadata = async (client, params, parent) => {
|
|
3
|
-
const blog = await client.content.blog({ params: await params });
|
|
4
|
-
if (blog.type === "not-found") {
|
|
5
|
-
return parent;
|
|
6
|
-
}
|
|
7
|
-
const previousImages = (await parent).openGraph?.images || [];
|
|
8
|
-
if (blog.type === "post") {
|
|
9
|
-
const openGraphImageKey = blog.data?.titleFile?.fileKey;
|
|
10
|
-
const images = openGraphImageKey ? [`${opinlyConfig.imagesUrl}/${openGraphImageKey}`, ...previousImages] : previousImages;
|
|
11
|
-
return {
|
|
12
|
-
...parent,
|
|
13
|
-
title: blog.data.title,
|
|
14
|
-
openGraph: {
|
|
15
|
-
images,
|
|
16
|
-
type: "article",
|
|
17
|
-
authors: blog.data.author && [
|
|
18
|
-
`${opinlyConfig.blogUrl}/authors/${blog.data.author.slug}`
|
|
19
|
-
]
|
|
20
|
-
},
|
|
21
|
-
// keywords: [blog.data.keywords],
|
|
22
|
-
authors: blog.data.author && [
|
|
23
|
-
{
|
|
24
|
-
name: blog.data.author.name,
|
|
25
|
-
url: `${opinlyConfig.blogUrl}/authors/${blog.data.author.slug}`
|
|
26
|
-
}
|
|
27
|
-
],
|
|
28
|
-
other: {}
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
return parent;
|
|
32
|
-
};
|
|
33
|
-
export {
|
|
34
|
-
generateOpinlyMetadata
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=generate-metadata.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/generate-metadata.ts"],"sourcesContent":["import { Opinly } from \"@opinly/backend\";\nimport type { Metadata, ResolvingMetadata } from \"next\";\nimport { opinlyConfig } from \"./sdk-config\";\n\nexport const generateOpinlyMetadata = async (\n client: Opinly,\n params: Promise<{\n slug: string[];\n }>,\n parent: ResolvingMetadata\n): Promise<Metadata> => {\n const blog = await client.content.blog({ params: await params });\n\n if (blog.type === \"not-found\") {\n return parent as Metadata;\n }\n\n const previousImages = (await parent).openGraph?.images || [];\n\n if (blog.type === \"post\") {\n const openGraphImageKey = blog.data?.titleFile?.fileKey;\n\n const images = openGraphImageKey\n ? [`${opinlyConfig.imagesUrl}/${openGraphImageKey}`, ...previousImages]\n : previousImages;\n\n return {\n ...(parent as Metadata),\n title: blog.data.title,\n openGraph: {\n images: images,\n type: \"article\",\n authors: blog.data.author && [\n `${opinlyConfig.blogUrl}/authors/${blog.data.author.slug}`,\n ],\n },\n // keywords: [blog.data.keywords],\n authors: blog.data.author && [\n {\n name: blog.data.author.name,\n url: `${opinlyConfig.blogUrl}/authors/${blog.data.author.slug}`,\n },\n ],\n other: {},\n };\n }\n\n return parent as Metadata;\n};\n"],"mappings":"AAEA,SAAS,oBAAoB;AAEtB,MAAM,yBAAyB,OACpC,QACA,QAGA,WACsB;AACtB,QAAM,OAAO,MAAM,OAAO,QAAQ,KAAK,EAAE,QAAQ,MAAM,OAAO,CAAC;AAE/D,MAAI,KAAK,SAAS,aAAa;AAC7B,WAAO;AAAA,EACT;AAEA,QAAM,kBAAkB,MAAM,QAAQ,WAAW,UAAU,CAAC;AAE5D,MAAI,KAAK,SAAS,QAAQ;AACxB,UAAM,oBAAoB,KAAK,MAAM,WAAW;AAEhD,UAAM,SAAS,oBACX,CAAC,GAAG,aAAa,SAAS,IAAI,iBAAiB,IAAI,GAAG,cAAc,IACpE;AAEJ,WAAO;AAAA,MACL,GAAI;AAAA,MACJ,OAAO,KAAK,KAAK;AAAA,MACjB,WAAW;AAAA,QACT;AAAA,QACA,MAAM;AAAA,QACN,SAAS,KAAK,KAAK,UAAU;AAAA,UAC3B,GAAG,aAAa,OAAO,YAAY,KAAK,KAAK,OAAO,IAAI;AAAA,QAC1D;AAAA,MACF;AAAA;AAAA,MAEA,SAAS,KAAK,KAAK,UAAU;AAAA,QAC3B;AAAA,UACE,MAAM,KAAK,KAAK,OAAO;AAAA,UACvB,KAAK,GAAG,aAAa,OAAO,YAAY,KAAK,KAAK,OAAO,IAAI;AAAA,QAC/D;AAAA,MACF;AAAA,MACA,OAAO,CAAC;AAAA,IACV;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
package/dist/utils/merge.mjs
DELETED
|
File without changes
|
/package/dist/components/blog-post/_helpers/{calc-reading-time.mjs.map → calc-reading-time.cjs.map}
RENAMED
|
File without changes
|