@opinly/next 0.1.9 → 0.1.10
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/index.cjs +1 -2
- package/dist/components/author-page/index.cjs.map +1 -1
- package/dist/components/author-page/index.js +1 -2
- package/dist/components/author-page/index.js.map +1 -1
- package/dist/components/authors-page/index.cjs +1 -2
- package/dist/components/authors-page/index.cjs.map +1 -1
- package/dist/components/authors-page/index.js +1 -2
- package/dist/components/authors-page/index.js.map +1 -1
- package/dist/components/blog-post/_components/content.cjs +18 -1
- package/dist/components/blog-post/_components/content.cjs.map +1 -1
- package/dist/components/blog-post/_components/content.js +18 -1
- package/dist/components/blog-post/_components/content.js.map +1 -1
- package/dist/components/blog-post/_components/table-of-contents.cjs +2 -2
- package/dist/components/blog-post/_components/table-of-contents.cjs.map +1 -1
- package/dist/components/blog-post/_components/table-of-contents.js +2 -2
- package/dist/components/blog-post/_components/table-of-contents.js.map +1 -1
- package/dist/components/blog-post/_helpers/json-ld.cjs +1 -2
- package/dist/components/blog-post/_helpers/json-ld.cjs.map +1 -1
- package/dist/components/blog-post/_helpers/json-ld.js +1 -2
- package/dist/components/blog-post/_helpers/json-ld.js.map +1 -1
- package/dist/components/home-page/folders.cjs +98 -0
- package/dist/components/home-page/folders.cjs.map +1 -0
- package/dist/components/home-page/folders.d.cts +9 -0
- package/dist/components/home-page/folders.d.ts +9 -0
- package/dist/components/home-page/folders.js +63 -0
- package/dist/components/home-page/folders.js.map +1 -0
- package/dist/components/home-page/index.cjs +44 -0
- package/dist/components/home-page/index.cjs.map +1 -0
- package/dist/components/home-page/index.d.cts +11 -0
- package/dist/components/home-page/index.d.ts +11 -0
- package/dist/components/home-page/index.js +20 -0
- package/dist/components/home-page/index.js.map +1 -0
- package/dist/components/{home-page.cjs → home-page/pagination.cjs} +48 -28
- package/dist/components/home-page/pagination.cjs.map +1 -0
- package/dist/components/home-page/pagination.d.cts +10 -0
- package/dist/components/home-page/pagination.d.ts +10 -0
- package/dist/components/home-page/pagination.js +57 -0
- package/dist/components/home-page/pagination.js.map +1 -0
- package/dist/components/home-page/top-posts.cjs +52 -0
- package/dist/components/home-page/top-posts.cjs.map +1 -0
- package/dist/components/home-page/top-posts.d.cts +9 -0
- package/dist/components/home-page/top-posts.d.ts +9 -0
- package/dist/components/home-page/top-posts.js +28 -0
- package/dist/components/home-page/top-posts.js.map +1 -0
- package/dist/components/opinly-blog.cjs +3 -2
- package/dist/components/opinly-blog.cjs.map +1 -1
- package/dist/components/opinly-blog.d.cts +5 -2
- package/dist/components/opinly-blog.d.ts +5 -2
- package/dist/components/opinly-blog.js +3 -2
- package/dist/components/opinly-blog.js.map +1 -1
- package/dist/components/post-preview.cjs +25 -7
- package/dist/components/post-preview.cjs.map +1 -1
- package/dist/components/post-preview.d.cts +3 -4
- package/dist/components/post-preview.d.ts +3 -4
- package/dist/components/post-preview.js +23 -6
- package/dist/components/post-preview.js.map +1 -1
- package/dist/index.cjs +1 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/dist/components/home-page.cjs.map +0 -1
- package/dist/components/home-page.d.cts +0 -12
- package/dist/components/home-page.d.ts +0 -12
- package/dist/components/home-page.js +0 -37
- package/dist/components/home-page.js.map +0 -1
- package/dist/utils/images.cjs +0 -35
- package/dist/utils/images.cjs.map +0 -1
- package/dist/utils/images.d.cts +0 -3
- package/dist/utils/images.d.ts +0 -3
- package/dist/utils/images.js +0 -11
- package/dist/utils/images.js.map +0 -1
|
@@ -30,13 +30,14 @@ var import_not_found = require("./not-found");
|
|
|
30
30
|
var import_authors_page = require("./authors-page");
|
|
31
31
|
const OpinlyBlog = ({
|
|
32
32
|
blog,
|
|
33
|
-
|
|
33
|
+
searchParams,
|
|
34
|
+
client
|
|
34
35
|
}) => {
|
|
35
36
|
if (blog.type === "not-found") {
|
|
36
37
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_not_found.OpinlyNotFound, {});
|
|
37
38
|
}
|
|
38
39
|
if (blog.type === "home") {
|
|
39
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_home_page.HomePage, {
|
|
40
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_home_page.HomePage, { searchParams, client });
|
|
40
41
|
}
|
|
41
42
|
if (blog.type === "post") {
|
|
42
43
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_blog_post.BlogPost, { post: blog.data });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/opinly-blog.tsx"],"sourcesContent":["import { BlogPost } from \"./blog-post\";\nimport { FolderPage } from \"./folder-page\";\nimport { Opinly } from \"@opinly/backend\";\nimport { HomePage } from \"./home-page\";\nimport { AuthorPage } from \"./author-page\";\nimport { OpinlyNotFound } from \"./not-found\";\nimport { AuthorsPage } from \"./authors-page\";\n\nexport const OpinlyBlog = ({\n blog,\n
|
|
1
|
+
{"version":3,"sources":["../../src/components/opinly-blog.tsx"],"sourcesContent":["import { BlogPost } from \"./blog-post\";\nimport { FolderPage } from \"./folder-page\";\nimport { Opinly, OpinlyClient } from \"@opinly/backend\";\nimport { HomePage } from \"./home-page\";\nimport { AuthorPage } from \"./author-page\";\nimport { OpinlyNotFound } from \"./not-found\";\nimport { AuthorsPage } from \"./authors-page\";\n\nexport const OpinlyBlog = ({\n blog,\n searchParams,\n client,\n}: {\n blog: Awaited<ReturnType<Opinly[\"content\"][\"blog\"]>>;\n client: Opinly;\n searchParams: { page?: string };\n}) => {\n if (blog.type === \"not-found\") {\n return <OpinlyNotFound />;\n }\n\n if (blog.type === \"home\") {\n return <HomePage searchParams={searchParams} client={client} />;\n }\n\n if (blog.type === \"post\") {\n return <BlogPost post={blog.data} />;\n }\n\n if (blog.type === \"author\") {\n return <AuthorPage author={blog.data} />;\n }\n\n if (blog.type === \"authors\") {\n return <AuthorsPage authors={blog.data} />;\n }\n\n return <FolderPage folder={blog.data} />;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBW;AAlBX,uBAAyB;AACzB,yBAA2B;AAE3B,uBAAyB;AACzB,yBAA2B;AAC3B,uBAA+B;AAC/B,0BAA4B;AAErB,MAAM,aAAa,CAAC;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AACF,MAIM;AACJ,MAAI,KAAK,SAAS,aAAa;AAC7B,WAAO,4CAAC,mCAAe;AAAA,EACzB;AAEA,MAAI,KAAK,SAAS,QAAQ;AACxB,WAAO,4CAAC,6BAAS,cAA4B,QAAgB;AAAA,EAC/D;AAEA,MAAI,KAAK,SAAS,QAAQ;AACxB,WAAO,4CAAC,6BAAS,MAAM,KAAK,MAAM;AAAA,EACpC;AAEA,MAAI,KAAK,SAAS,UAAU;AAC1B,WAAO,4CAAC,iCAAW,QAAQ,KAAK,MAAM;AAAA,EACxC;AAEA,MAAI,KAAK,SAAS,WAAW;AAC3B,WAAO,4CAAC,mCAAY,SAAS,KAAK,MAAM;AAAA,EAC1C;AAEA,SAAO,4CAAC,iCAAW,QAAQ,KAAK,MAAM;AACxC;","names":[]}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { Opinly } from '@opinly/backend';
|
|
3
3
|
|
|
4
|
-
declare const OpinlyBlog: ({ blog,
|
|
4
|
+
declare const OpinlyBlog: ({ blog, searchParams, client, }: {
|
|
5
5
|
blog: Awaited<ReturnType<Opinly["content"]["blog"]>>;
|
|
6
|
-
|
|
6
|
+
client: Opinly;
|
|
7
|
+
searchParams: {
|
|
8
|
+
page?: string;
|
|
9
|
+
};
|
|
7
10
|
}) => react_jsx_runtime.JSX.Element;
|
|
8
11
|
|
|
9
12
|
export { OpinlyBlog };
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { Opinly } from '@opinly/backend';
|
|
3
3
|
|
|
4
|
-
declare const OpinlyBlog: ({ blog,
|
|
4
|
+
declare const OpinlyBlog: ({ blog, searchParams, client, }: {
|
|
5
5
|
blog: Awaited<ReturnType<Opinly["content"]["blog"]>>;
|
|
6
|
-
|
|
6
|
+
client: Opinly;
|
|
7
|
+
searchParams: {
|
|
8
|
+
page?: string;
|
|
9
|
+
};
|
|
7
10
|
}) => react_jsx_runtime.JSX.Element;
|
|
8
11
|
|
|
9
12
|
export { OpinlyBlog };
|
|
@@ -7,13 +7,14 @@ import { OpinlyNotFound } from "./not-found";
|
|
|
7
7
|
import { AuthorsPage } from "./authors-page";
|
|
8
8
|
const OpinlyBlog = ({
|
|
9
9
|
blog,
|
|
10
|
-
|
|
10
|
+
searchParams,
|
|
11
|
+
client
|
|
11
12
|
}) => {
|
|
12
13
|
if (blog.type === "not-found") {
|
|
13
14
|
return /* @__PURE__ */ jsx(OpinlyNotFound, {});
|
|
14
15
|
}
|
|
15
16
|
if (blog.type === "home") {
|
|
16
|
-
return /* @__PURE__ */ jsx(HomePage, {
|
|
17
|
+
return /* @__PURE__ */ jsx(HomePage, { searchParams, client });
|
|
17
18
|
}
|
|
18
19
|
if (blog.type === "post") {
|
|
19
20
|
return /* @__PURE__ */ jsx(BlogPost, { post: blog.data });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/opinly-blog.tsx"],"sourcesContent":["import { BlogPost } from \"./blog-post\";\nimport { FolderPage } from \"./folder-page\";\nimport { Opinly } from \"@opinly/backend\";\nimport { HomePage } from \"./home-page\";\nimport { AuthorPage } from \"./author-page\";\nimport { OpinlyNotFound } from \"./not-found\";\nimport { AuthorsPage } from \"./authors-page\";\n\nexport const OpinlyBlog = ({\n blog,\n
|
|
1
|
+
{"version":3,"sources":["../../src/components/opinly-blog.tsx"],"sourcesContent":["import { BlogPost } from \"./blog-post\";\nimport { FolderPage } from \"./folder-page\";\nimport { Opinly, OpinlyClient } from \"@opinly/backend\";\nimport { HomePage } from \"./home-page\";\nimport { AuthorPage } from \"./author-page\";\nimport { OpinlyNotFound } from \"./not-found\";\nimport { AuthorsPage } from \"./authors-page\";\n\nexport const OpinlyBlog = ({\n blog,\n searchParams,\n client,\n}: {\n blog: Awaited<ReturnType<Opinly[\"content\"][\"blog\"]>>;\n client: Opinly;\n searchParams: { page?: string };\n}) => {\n if (blog.type === \"not-found\") {\n return <OpinlyNotFound />;\n }\n\n if (blog.type === \"home\") {\n return <HomePage searchParams={searchParams} client={client} />;\n }\n\n if (blog.type === \"post\") {\n return <BlogPost post={blog.data} />;\n }\n\n if (blog.type === \"author\") {\n return <AuthorPage author={blog.data} />;\n }\n\n if (blog.type === \"authors\") {\n return <AuthorsPage authors={blog.data} />;\n }\n\n return <FolderPage folder={blog.data} />;\n};\n"],"mappings":"AAkBW;AAlBX,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAE3B,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB;AAErB,MAAM,aAAa,CAAC;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AACF,MAIM;AACJ,MAAI,KAAK,SAAS,aAAa;AAC7B,WAAO,oBAAC,kBAAe;AAAA,EACzB;AAEA,MAAI,KAAK,SAAS,QAAQ;AACxB,WAAO,oBAAC,YAAS,cAA4B,QAAgB;AAAA,EAC/D;AAEA,MAAI,KAAK,SAAS,QAAQ;AACxB,WAAO,oBAAC,YAAS,MAAM,KAAK,MAAM;AAAA,EACpC;AAEA,MAAI,KAAK,SAAS,UAAU;AAC1B,WAAO,oBAAC,cAAW,QAAQ,KAAK,MAAM;AAAA,EACxC;AAEA,MAAI,KAAK,SAAS,WAAW;AAC3B,WAAO,oBAAC,eAAY,SAAS,KAAK,MAAM;AAAA,EAC1C;AAEA,SAAO,oBAAC,cAAW,QAAQ,KAAK,MAAM;AACxC;","names":[]}
|
|
@@ -28,29 +28,46 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var post_preview_exports = {};
|
|
30
30
|
__export(post_preview_exports, {
|
|
31
|
-
PostPreview: () => PostPreview
|
|
31
|
+
PostPreview: () => PostPreview,
|
|
32
|
+
PostPreviewSkeleton: () => PostPreviewSkeleton
|
|
32
33
|
});
|
|
33
34
|
module.exports = __toCommonJS(post_preview_exports);
|
|
34
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
36
|
var import_link = __toESM(require("next/link"), 1);
|
|
36
37
|
var import_image = __toESM(require("next/image"), 1);
|
|
37
38
|
var import_sdk_config = require("../utils/sdk-config");
|
|
38
|
-
var import_images = require("../utils/images");
|
|
39
39
|
var import_dates = require("../utils/dates");
|
|
40
|
+
const PostPreviewSkeleton = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "w-full h-full ", children: [
|
|
41
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "animate-pulse mb-5", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "w-full h-48 bg-gray-200 dark:bg-gray-700 rounded-lg" }) }),
|
|
42
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center space-x-2 text-sm text-muted-foreground mb-3", children: [
|
|
43
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "animate-pulse h-4 w-20 bg-gray-200 dark:bg-gray-700 rounded" }),
|
|
44
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "animate-pulse h-4 w-1 bg-gray-200 dark:bg-gray-700 rounded-full" }),
|
|
45
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "animate-pulse h-4 w-16 bg-gray-200 dark:bg-gray-700 rounded" })
|
|
46
|
+
] }),
|
|
47
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "animate-pulse h-5 w-3/4 bg-gray-200 dark:bg-gray-700 rounded mb-2" }),
|
|
48
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1 mt-1 pr-4", children: [
|
|
49
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "animate-pulse h-4 w-full bg-gray-200 dark:bg-gray-700 rounded" }),
|
|
50
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "animate-pulse h-4 w-10/12 bg-gray-200 dark:bg-gray-700 rounded" })
|
|
51
|
+
] }),
|
|
52
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center space-x-2 text-xs text-gray-500 mt-2", children: [
|
|
53
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "animate-pulse h-3 w-24 bg-gray-200 dark:bg-gray-700 rounded" }),
|
|
54
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "animate-pulse h-3 w-12 bg-gray-200 dark:bg-gray-700 rounded" })
|
|
55
|
+
] })
|
|
56
|
+
] });
|
|
40
57
|
const PostPreview = ({
|
|
41
58
|
post
|
|
42
59
|
}) => {
|
|
43
60
|
const postSlug = `${import_sdk_config.opinlyConfig.blogPrefix}/${post.folder?.slug ? `${post.folder.slug}/` : ""}${post.slug}`;
|
|
44
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
61
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "w-full h-full ", children: [
|
|
45
62
|
post.image?.fileKey && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.default, { href: postSlug, className: "group", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "relative w-full h-48 mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
46
63
|
import_image.default,
|
|
47
64
|
{
|
|
48
|
-
src: `${import_sdk_config.opinlyConfig.imagesPrefix}/${
|
|
65
|
+
src: `${import_sdk_config.opinlyConfig.imagesPrefix}/${post.image.fileKey}`,
|
|
49
66
|
alt: post.title,
|
|
50
67
|
fill: true,
|
|
51
68
|
className: "object-cover rounded-lg"
|
|
52
69
|
}
|
|
53
|
-
) }) }
|
|
70
|
+
) }) }),
|
|
54
71
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "text-sm text-muted-foreground mb-1", children: [
|
|
55
72
|
post.folder?.name && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
56
73
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -66,7 +83,7 @@ const PostPreview = ({
|
|
|
66
83
|
" ",
|
|
67
84
|
(0, import_dates.formatDate)(post.firstPublishedAt)
|
|
68
85
|
] }),
|
|
69
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.default, { href: postSlug, className: "group", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "text-lg font-semibold leading-snug group-hover:underline", children: post.title }) }
|
|
86
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.default, { href: postSlug, className: "group", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "text-lg font-semibold leading-snug group-hover:underline", children: post.title }) }),
|
|
70
87
|
post.description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-gray-600 mt-1 line-clamp-2", children: post.description }),
|
|
71
88
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "text-xs text-gray-500 mt-2", children: [
|
|
72
89
|
post.author && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
@@ -88,6 +105,7 @@ const PostPreview = ({
|
|
|
88
105
|
};
|
|
89
106
|
// Annotate the CommonJS export names for ESM import in node:
|
|
90
107
|
0 && (module.exports = {
|
|
91
|
-
PostPreview
|
|
108
|
+
PostPreview,
|
|
109
|
+
PostPreviewSkeleton
|
|
92
110
|
});
|
|
93
111
|
//# sourceMappingURL=post-preview.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/post-preview.tsx"],"sourcesContent":["import { Opinly } from \"@opinly/backend\";\nimport Link from \"next/link\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../utils/sdk-config\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/components/post-preview.tsx"],"sourcesContent":["import { Opinly } from \"@opinly/backend\";\nimport Link from \"next/link\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../utils/sdk-config\";\nimport { formatDate } from \"../utils/dates\";\n\nexport const PostPreviewSkeleton: React.FC = () => (\n <div className=\"w-full h-full \">\n {/* Image placeholder (with same mb-4 as real) */}\n <div className=\"animate-pulse mb-5\">\n <div className=\"w-full h-48 bg-gray-200 dark:bg-gray-700 rounded-lg\" />\n </div>\n\n {/* Folder · dot · date (text-sm text-muted-foreground mb-1) */}\n <div className=\"flex items-center space-x-2 text-sm text-muted-foreground mb-3\">\n <div className=\"animate-pulse h-4 w-20 bg-gray-200 dark:bg-gray-700 rounded\" />\n <div className=\"animate-pulse h-4 w-1 bg-gray-200 dark:bg-gray-700 rounded-full\" />\n <div className=\"animate-pulse h-4 w-16 bg-gray-200 dark:bg-gray-700 rounded\" />\n </div>\n\n {/* Title (text-lg font-semibold leading-snug) */}\n <div className=\"animate-pulse h-5 w-3/4 bg-gray-200 dark:bg-gray-700 rounded mb-2\" />\n\n {/* Description (text-sm mt-1 line-clamp-2) */}\n <div className=\"space-y-1 mt-1 pr-4\">\n <div className=\"animate-pulse h-4 w-full bg-gray-200 dark:bg-gray-700 rounded\" />\n <div className=\"animate-pulse h-4 w-10/12 bg-gray-200 dark:bg-gray-700 rounded\" />\n </div>\n\n {/* Author · date (text-xs text-gray-500 mt-2 flex items-center space-x-2) */}\n <div className=\"flex items-center space-x-2 text-xs text-gray-500 mt-2\">\n <div className=\"animate-pulse h-3 w-24 bg-gray-200 dark:bg-gray-700 rounded\" />\n <div className=\"animate-pulse h-3 w-12 bg-gray-200 dark:bg-gray-700 rounded\" />\n </div>\n </div>\n);\nexport const PostPreview = ({\n post,\n}: {\n post: NonNullable<\n NonNullable<\n Awaited<\n ReturnType<Opinly[\"client\"][\"content\"][\"authorPage\"][\"query\"]>\n >[\"data\"]\n >[\"posts\"][number]\n >;\n}) => {\n const postSlug = `${opinlyConfig.blogPrefix}/${post.folder?.slug ? `${post.folder.slug}/` : \"\"}${post.slug}`;\n\n return (\n <div className=\"w-full h-full \">\n {post.image?.fileKey && (\n <Link href={postSlug} className=\"group\">\n <div className=\"relative w-full h-48 mb-4\">\n <Image\n src={`${opinlyConfig.imagesPrefix}/${post.image.fileKey}`}\n alt={post.title}\n fill\n className=\"object-cover rounded-lg\"\n />\n </div>\n </Link>\n )}\n <div className=\"text-sm text-muted-foreground mb-1\">\n {post.folder?.name && (\n <>\n <Link\n href={`${opinlyConfig.blogPrefix}/${post.folder.slug}`}\n className=\"hover:underline\"\n >\n {post.folder.name}\n </Link>\n <span className=\"mx-1\">·</span>\n </>\n )}{\" \"}\n {formatDate(post.firstPublishedAt as string)}\n </div>\n <Link href={postSlug} className=\"group\">\n <h2 className=\"text-lg font-semibold leading-snug group-hover:underline\">\n {post.title}\n </h2>\n </Link>\n\n {post.description && (\n <p className=\"text-sm text-gray-600 mt-1 line-clamp-2\">\n {post.description}\n </p>\n )}\n <div className=\"text-xs text-gray-500 mt-2\">\n {post.author && (\n <>\n <Link\n href={`${opinlyConfig.blogPrefix}/authors/${post.author.slug}`}\n className=\"font-medium hover:underline\"\n >\n {post.author?.name}\n </Link>{\" \"}\n <span className=\"mx-1\">·</span>\n </>\n )}{\" \"}\n {formatDate(post.firstPublishedAt as string)}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUM;AATN,kBAAiB;AACjB,mBAAkB;AAClB,wBAA6B;AAC7B,mBAA2B;AAEpB,MAAM,sBAAgC,MAC3C,6CAAC,SAAI,WAAU,kBAEb;AAAA,8CAAC,SAAI,WAAU,sBACb,sDAAC,SAAI,WAAU,uDAAsD,GACvE;AAAA,EAGA,6CAAC,SAAI,WAAU,kEACb;AAAA,gDAAC,SAAI,WAAU,+DAA8D;AAAA,IAC7E,4CAAC,SAAI,WAAU,mEAAkE;AAAA,IACjF,4CAAC,SAAI,WAAU,+DAA8D;AAAA,KAC/E;AAAA,EAGA,4CAAC,SAAI,WAAU,qEAAoE;AAAA,EAGnF,6CAAC,SAAI,WAAU,uBACb;AAAA,gDAAC,SAAI,WAAU,iEAAgE;AAAA,IAC/E,4CAAC,SAAI,WAAU,kEAAiE;AAAA,KAClF;AAAA,EAGA,6CAAC,SAAI,WAAU,0DACb;AAAA,gDAAC,SAAI,WAAU,+DAA8D;AAAA,IAC7E,4CAAC,SAAI,WAAU,+DAA8D;AAAA,KAC/E;AAAA,GACF;AAEK,MAAM,cAAc,CAAC;AAAA,EAC1B;AACF,MAQM;AACJ,QAAM,WAAW,GAAG,+BAAa,UAAU,IAAI,KAAK,QAAQ,OAAO,GAAG,KAAK,OAAO,IAAI,MAAM,EAAE,GAAG,KAAK,IAAI;AAE1G,SACE,6CAAC,SAAI,WAAU,kBACZ;AAAA,SAAK,OAAO,WACX,4CAAC,YAAAA,SAAA,EAAK,MAAM,UAAU,WAAU,SAC9B,sDAAC,SAAI,WAAU,6BACb;AAAA,MAAC,aAAAC;AAAA,MAAA;AAAA,QACC,KAAK,GAAG,+BAAa,YAAY,IAAI,KAAK,MAAM,OAAO;AAAA,QACvD,KAAK,KAAK;AAAA,QACV,MAAI;AAAA,QACJ,WAAU;AAAA;AAAA,IACZ,GACF,GACF;AAAA,IAEF,6CAAC,SAAI,WAAU,sCACZ;AAAA,WAAK,QAAQ,QACZ,4EACE;AAAA;AAAA,UAAC,YAAAD;AAAA,UAAA;AAAA,YACC,MAAM,GAAG,+BAAa,UAAU,IAAI,KAAK,OAAO,IAAI;AAAA,YACpD,WAAU;AAAA,YAET,eAAK,OAAO;AAAA;AAAA,QACf;AAAA,QACA,4CAAC,UAAK,WAAU,QAAO,kBAAC;AAAA,SAC1B;AAAA,MACC;AAAA,UACF,yBAAW,KAAK,gBAA0B;AAAA,OAC7C;AAAA,IACA,4CAAC,YAAAA,SAAA,EAAK,MAAM,UAAU,WAAU,SAC9B,sDAAC,QAAG,WAAU,4DACX,eAAK,OACR,GACF;AAAA,IAEC,KAAK,eACJ,4CAAC,OAAE,WAAU,2CACV,eAAK,aACR;AAAA,IAEF,6CAAC,SAAI,WAAU,8BACZ;AAAA,WAAK,UACJ,4EACE;AAAA;AAAA,UAAC,YAAAA;AAAA,UAAA;AAAA,YACC,MAAM,GAAG,+BAAa,UAAU,YAAY,KAAK,OAAO,IAAI;AAAA,YAC5D,WAAU;AAAA,YAET,eAAK,QAAQ;AAAA;AAAA,QAChB;AAAA,QAAQ;AAAA,QACR,4CAAC,UAAK,WAAU,QAAO,kBAAC;AAAA,SAC1B;AAAA,MACC;AAAA,UACF,yBAAW,KAAK,gBAA0B;AAAA,OAC7C;AAAA,KACF;AAEJ;","names":["Link","Image"]}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { Opinly } from '@opinly/backend';
|
|
3
3
|
|
|
4
|
+
declare const PostPreviewSkeleton: React.FC;
|
|
4
5
|
declare const PostPreview: ({ post, }: {
|
|
5
|
-
post:
|
|
6
|
-
type: "home";
|
|
7
|
-
}>["data"]["posts"][number];
|
|
6
|
+
post: NonNullable<NonNullable<Awaited<ReturnType<Opinly["client"]["content"]["authorPage"]["query"]>>["data"]>["posts"][number]>;
|
|
8
7
|
}) => react_jsx_runtime.JSX.Element;
|
|
9
8
|
|
|
10
|
-
export { PostPreview };
|
|
9
|
+
export { PostPreview, PostPreviewSkeleton };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { Opinly } from '@opinly/backend';
|
|
3
3
|
|
|
4
|
+
declare const PostPreviewSkeleton: React.FC;
|
|
4
5
|
declare const PostPreview: ({ post, }: {
|
|
5
|
-
post:
|
|
6
|
-
type: "home";
|
|
7
|
-
}>["data"]["posts"][number];
|
|
6
|
+
post: NonNullable<NonNullable<Awaited<ReturnType<Opinly["client"]["content"]["authorPage"]["query"]>>["data"]>["posts"][number]>;
|
|
8
7
|
}) => react_jsx_runtime.JSX.Element;
|
|
9
8
|
|
|
10
|
-
export { PostPreview };
|
|
9
|
+
export { PostPreview, PostPreviewSkeleton };
|
|
@@ -2,22 +2,38 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import Link from "next/link";
|
|
3
3
|
import Image from "next/image";
|
|
4
4
|
import { opinlyConfig } from "../utils/sdk-config";
|
|
5
|
-
import { replaceImageNameSpace } from "../utils/images";
|
|
6
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
|
+
] });
|
|
7
23
|
const PostPreview = ({
|
|
8
24
|
post
|
|
9
25
|
}) => {
|
|
10
26
|
const postSlug = `${opinlyConfig.blogPrefix}/${post.folder?.slug ? `${post.folder.slug}/` : ""}${post.slug}`;
|
|
11
|
-
return /* @__PURE__ */ jsxs("div", { children: [
|
|
27
|
+
return /* @__PURE__ */ jsxs("div", { className: "w-full h-full ", children: [
|
|
12
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(
|
|
13
29
|
Image,
|
|
14
30
|
{
|
|
15
|
-
src: `${opinlyConfig.imagesPrefix}/${
|
|
31
|
+
src: `${opinlyConfig.imagesPrefix}/${post.image.fileKey}`,
|
|
16
32
|
alt: post.title,
|
|
17
33
|
fill: true,
|
|
18
34
|
className: "object-cover rounded-lg"
|
|
19
35
|
}
|
|
20
|
-
) }) }
|
|
36
|
+
) }) }),
|
|
21
37
|
/* @__PURE__ */ jsxs("div", { className: "text-sm text-muted-foreground mb-1", children: [
|
|
22
38
|
post.folder?.name && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
23
39
|
/* @__PURE__ */ jsx(
|
|
@@ -33,7 +49,7 @@ const PostPreview = ({
|
|
|
33
49
|
" ",
|
|
34
50
|
formatDate(post.firstPublishedAt)
|
|
35
51
|
] }),
|
|
36
|
-
/* @__PURE__ */ jsx(Link, { href: postSlug, className: "group", children: /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold leading-snug group-hover:underline", children: post.title }) }
|
|
52
|
+
/* @__PURE__ */ jsx(Link, { href: postSlug, className: "group", children: /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold leading-snug group-hover:underline", children: post.title }) }),
|
|
37
53
|
post.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600 mt-1 line-clamp-2", children: post.description }),
|
|
38
54
|
/* @__PURE__ */ jsxs("div", { className: "text-xs text-gray-500 mt-2", children: [
|
|
39
55
|
post.author && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -54,6 +70,7 @@ const PostPreview = ({
|
|
|
54
70
|
] });
|
|
55
71
|
};
|
|
56
72
|
export {
|
|
57
|
-
PostPreview
|
|
73
|
+
PostPreview,
|
|
74
|
+
PostPreviewSkeleton
|
|
58
75
|
};
|
|
59
76
|
//# sourceMappingURL=post-preview.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/post-preview.tsx"],"sourcesContent":["import { Opinly } from \"@opinly/backend\";\nimport Link from \"next/link\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../utils/sdk-config\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/components/post-preview.tsx"],"sourcesContent":["import { Opinly } from \"@opinly/backend\";\nimport Link from \"next/link\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../utils/sdk-config\";\nimport { formatDate } from \"../utils/dates\";\n\nexport const PostPreviewSkeleton: React.FC = () => (\n <div className=\"w-full h-full \">\n {/* Image placeholder (with same mb-4 as real) */}\n <div className=\"animate-pulse mb-5\">\n <div className=\"w-full h-48 bg-gray-200 dark:bg-gray-700 rounded-lg\" />\n </div>\n\n {/* Folder · dot · date (text-sm text-muted-foreground mb-1) */}\n <div className=\"flex items-center space-x-2 text-sm text-muted-foreground mb-3\">\n <div className=\"animate-pulse h-4 w-20 bg-gray-200 dark:bg-gray-700 rounded\" />\n <div className=\"animate-pulse h-4 w-1 bg-gray-200 dark:bg-gray-700 rounded-full\" />\n <div className=\"animate-pulse h-4 w-16 bg-gray-200 dark:bg-gray-700 rounded\" />\n </div>\n\n {/* Title (text-lg font-semibold leading-snug) */}\n <div className=\"animate-pulse h-5 w-3/4 bg-gray-200 dark:bg-gray-700 rounded mb-2\" />\n\n {/* Description (text-sm mt-1 line-clamp-2) */}\n <div className=\"space-y-1 mt-1 pr-4\">\n <div className=\"animate-pulse h-4 w-full bg-gray-200 dark:bg-gray-700 rounded\" />\n <div className=\"animate-pulse h-4 w-10/12 bg-gray-200 dark:bg-gray-700 rounded\" />\n </div>\n\n {/* Author · date (text-xs text-gray-500 mt-2 flex items-center space-x-2) */}\n <div className=\"flex items-center space-x-2 text-xs text-gray-500 mt-2\">\n <div className=\"animate-pulse h-3 w-24 bg-gray-200 dark:bg-gray-700 rounded\" />\n <div className=\"animate-pulse h-3 w-12 bg-gray-200 dark:bg-gray-700 rounded\" />\n </div>\n </div>\n);\nexport const PostPreview = ({\n post,\n}: {\n post: NonNullable<\n NonNullable<\n Awaited<\n ReturnType<Opinly[\"client\"][\"content\"][\"authorPage\"][\"query\"]>\n >[\"data\"]\n >[\"posts\"][number]\n >;\n}) => {\n const postSlug = `${opinlyConfig.blogPrefix}/${post.folder?.slug ? `${post.folder.slug}/` : \"\"}${post.slug}`;\n\n return (\n <div className=\"w-full h-full \">\n {post.image?.fileKey && (\n <Link href={postSlug} className=\"group\">\n <div className=\"relative w-full h-48 mb-4\">\n <Image\n src={`${opinlyConfig.imagesPrefix}/${post.image.fileKey}`}\n alt={post.title}\n fill\n className=\"object-cover rounded-lg\"\n />\n </div>\n </Link>\n )}\n <div className=\"text-sm text-muted-foreground mb-1\">\n {post.folder?.name && (\n <>\n <Link\n href={`${opinlyConfig.blogPrefix}/${post.folder.slug}`}\n className=\"hover:underline\"\n >\n {post.folder.name}\n </Link>\n <span className=\"mx-1\">·</span>\n </>\n )}{\" \"}\n {formatDate(post.firstPublishedAt as string)}\n </div>\n <Link href={postSlug} className=\"group\">\n <h2 className=\"text-lg font-semibold leading-snug group-hover:underline\">\n {post.title}\n </h2>\n </Link>\n\n {post.description && (\n <p className=\"text-sm text-gray-600 mt-1 line-clamp-2\">\n {post.description}\n </p>\n )}\n <div className=\"text-xs text-gray-500 mt-2\">\n {post.author && (\n <>\n <Link\n href={`${opinlyConfig.blogPrefix}/authors/${post.author.slug}`}\n className=\"font-medium hover:underline\"\n >\n {post.author?.name}\n </Link>{\" \"}\n <span className=\"mx-1\">·</span>\n </>\n )}{\" \"}\n {formatDate(post.firstPublishedAt as string)}\n </div>\n </div>\n );\n};\n"],"mappings":"AAUM,SAuDI,UAvDJ,KAIF,YAJE;AATN,OAAO,UAAU;AACjB,OAAO,WAAW;AAClB,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAEpB,MAAM,sBAAgC,MAC3C,qBAAC,SAAI,WAAU,kBAEb;AAAA,sBAAC,SAAI,WAAU,sBACb,8BAAC,SAAI,WAAU,uDAAsD,GACvE;AAAA,EAGA,qBAAC,SAAI,WAAU,kEACb;AAAA,wBAAC,SAAI,WAAU,+DAA8D;AAAA,IAC7E,oBAAC,SAAI,WAAU,mEAAkE;AAAA,IACjF,oBAAC,SAAI,WAAU,+DAA8D;AAAA,KAC/E;AAAA,EAGA,oBAAC,SAAI,WAAU,qEAAoE;AAAA,EAGnF,qBAAC,SAAI,WAAU,uBACb;AAAA,wBAAC,SAAI,WAAU,iEAAgE;AAAA,IAC/E,oBAAC,SAAI,WAAU,kEAAiE;AAAA,KAClF;AAAA,EAGA,qBAAC,SAAI,WAAU,0DACb;AAAA,wBAAC,SAAI,WAAU,+DAA8D;AAAA,IAC7E,oBAAC,SAAI,WAAU,+DAA8D;AAAA,KAC/E;AAAA,GACF;AAEK,MAAM,cAAc,CAAC;AAAA,EAC1B;AACF,MAQM;AACJ,QAAM,WAAW,GAAG,aAAa,UAAU,IAAI,KAAK,QAAQ,OAAO,GAAG,KAAK,OAAO,IAAI,MAAM,EAAE,GAAG,KAAK,IAAI;AAE1G,SACE,qBAAC,SAAI,WAAU,kBACZ;AAAA,SAAK,OAAO,WACX,oBAAC,QAAK,MAAM,UAAU,WAAU,SAC9B,8BAAC,SAAI,WAAU,6BACb;AAAA,MAAC;AAAA;AAAA,QACC,KAAK,GAAG,aAAa,YAAY,IAAI,KAAK,MAAM,OAAO;AAAA,QACvD,KAAK,KAAK;AAAA,QACV,MAAI;AAAA,QACJ,WAAU;AAAA;AAAA,IACZ,GACF,GACF;AAAA,IAEF,qBAAC,SAAI,WAAU,sCACZ;AAAA,WAAK,QAAQ,QACZ,iCACE;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,MAAM,GAAG,aAAa,UAAU,IAAI,KAAK,OAAO,IAAI;AAAA,YACpD,WAAU;AAAA,YAET,eAAK,OAAO;AAAA;AAAA,QACf;AAAA,QACA,oBAAC,UAAK,WAAU,QAAO,kBAAC;AAAA,SAC1B;AAAA,MACC;AAAA,MACF,WAAW,KAAK,gBAA0B;AAAA,OAC7C;AAAA,IACA,oBAAC,QAAK,MAAM,UAAU,WAAU,SAC9B,8BAAC,QAAG,WAAU,4DACX,eAAK,OACR,GACF;AAAA,IAEC,KAAK,eACJ,oBAAC,OAAE,WAAU,2CACV,eAAK,aACR;AAAA,IAEF,qBAAC,SAAI,WAAU,8BACZ;AAAA,WAAK,UACJ,iCACE;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,MAAM,GAAG,aAAa,UAAU,YAAY,KAAK,OAAO,IAAI;AAAA,YAC5D,WAAU;AAAA,YAET,eAAK,QAAQ;AAAA;AAAA,QAChB;AAAA,QAAQ;AAAA,QACR,oBAAC,UAAK,WAAU,QAAO,kBAAC;AAAA,SAC1B;AAAA,MACC;AAAA,MACF,WAAW,KAAK,gBAA0B;AAAA,OAC7C;AAAA,KACF;AAEJ;","names":[]}
|
package/dist/index.cjs
CHANGED
|
@@ -16,10 +16,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
16
16
|
var index_exports = {};
|
|
17
17
|
module.exports = __toCommonJS(index_exports);
|
|
18
18
|
__reExport(index_exports, require("./components/opinly-blog"), module.exports);
|
|
19
|
-
__reExport(index_exports, require("./components/home-page"), module.exports);
|
|
20
19
|
// Annotate the CommonJS export names for ESM import in node:
|
|
21
20
|
0 && (module.exports = {
|
|
22
|
-
...require("./components/opinly-blog")
|
|
23
|
-
...require("./components/home-page")
|
|
21
|
+
...require("./components/opinly-blog")
|
|
24
22
|
});
|
|
25
23
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from \"./components/opinly-blog\";\
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from \"./components/opinly-blog\";\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,qCAAd;","names":[]}
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from \"./components/opinly-blog\";\
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from \"./components/opinly-blog\";\n"],"mappings":"AAAA,cAAc;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opinly/next",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"react-syntax-highlighter": "^15.6.1",
|
|
30
30
|
"schema-dts": "^1.1.5",
|
|
31
31
|
"tailwind-merge": "^1.14.0",
|
|
32
|
-
"@opinly/backend": "0.1.
|
|
32
|
+
"@opinly/backend": "0.1.10"
|
|
33
33
|
},
|
|
34
34
|
"engines": {
|
|
35
35
|
"node": ">=16"
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"build": "tsup",
|
|
63
|
+
"dev": "tsup --config tsup.config.ts --watch",
|
|
63
64
|
"lint": "eslint src/",
|
|
64
65
|
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
|
|
65
66
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/home-page.tsx"],"sourcesContent":["import Link from \"next/link\";\n\nimport { Opinly } from \"@opinly/backend\";\nimport { PostPreview } from \"./post-preview\";\n\ntype HomePage = Extract<\n Awaited<ReturnType<Opinly[\"content\"][\"blog\"]>>,\n { type: \"home\" }\n>[\"data\"];\n\nexport const HomePage = ({\n homePage,\n page,\n}: {\n homePage: HomePage;\n page: number | null | undefined;\n}) => {\n const { posts, folders, count } = homePage;\n\n console.log(\"posts\", JSON.stringify(posts, null, 2));\n\n const currentPage = page;\n const totalPages = Math.ceil(count / 10);\n\n return (\n <div className=\"max-w-7xl mx-auto px-4 py-10\">\n {/* Posts Grid */}\n <div className=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-10\">\n {posts.map((post) => (\n <PostPreview key={post.slug} post={post} />\n ))}\n </div>\n\n {/* Pagination */}\n <div className=\"flex justify-center items-center mt-10 gap-2\">\n {Array.from({ length: totalPages }, (_, i) => i + 1).map((p) => (\n <Link\n key={p}\n href={`?page=${p}`}\n className={`px-3 py-1 border rounded ${\n p === currentPage\n ? \"bg-black text-white\"\n : \"hover:bg-gray-100 text-gray-700\"\n }`}\n >\n {p}\n </Link>\n ))}\n </div>\n\n {/* Folder tags */}\n <div className=\"flex flex-wrap gap-2 mb-10\">\n {folders.map((folder) => (\n <Link\n key={folder.slug}\n href={`/blog/${folder.slug}`}\n className=\"px-4 py-1 bg-gray-100 text-sm rounded-full hover:bg-gray-200\"\n >\n {folder.title}\n </Link>\n ))}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAyBI;AAzBJ,kBAAiB;AAGjB,0BAA4B;AAOrB,MAAM,WAAW,CAAC;AAAA,EACvB;AAAA,EACA;AACF,MAGM;AACJ,QAAM,EAAE,OAAO,SAAS,MAAM,IAAI;AAElC,UAAQ,IAAI,SAAS,KAAK,UAAU,OAAO,MAAM,CAAC,CAAC;AAEnD,QAAM,cAAc;AACpB,QAAM,aAAa,KAAK,KAAK,QAAQ,EAAE;AAEvC,SACE,6CAAC,SAAI,WAAU,gCAEb;AAAA,gDAAC,SAAI,WAAU,yDACZ,gBAAM,IAAI,CAAC,SACV,4CAAC,mCAA4B,QAAX,KAAK,IAAkB,CAC1C,GACH;AAAA,IAGA,4CAAC,SAAI,WAAU,gDACZ,gBAAM,KAAK,EAAE,QAAQ,WAAW,GAAG,CAAC,GAAG,MAAM,IAAI,CAAC,EAAE,IAAI,CAAC,MACxD;AAAA,MAAC,YAAAA;AAAA,MAAA;AAAA,QAEC,MAAM,SAAS,CAAC;AAAA,QAChB,WAAW,4BACT,MAAM,cACF,wBACA,iCACN;AAAA,QAEC;AAAA;AAAA,MARI;AAAA,IASP,CACD,GACH;AAAA,IAGA,4CAAC,SAAI,WAAU,8BACZ,kBAAQ,IAAI,CAAC,WACZ;AAAA,MAAC,YAAAA;AAAA,MAAA;AAAA,QAEC,MAAM,SAAS,OAAO,IAAI;AAAA,QAC1B,WAAU;AAAA,QAET,iBAAO;AAAA;AAAA,MAJH,OAAO;AAAA,IAKd,CACD,GACH;AAAA,KACF;AAEJ;","names":["Link"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { Opinly } from '@opinly/backend';
|
|
3
|
-
|
|
4
|
-
type HomePage = Extract<Awaited<ReturnType<Opinly["content"]["blog"]>>, {
|
|
5
|
-
type: "home";
|
|
6
|
-
}>["data"];
|
|
7
|
-
declare const HomePage: ({ homePage, page, }: {
|
|
8
|
-
homePage: HomePage;
|
|
9
|
-
page: number | null | undefined;
|
|
10
|
-
}) => react_jsx_runtime.JSX.Element;
|
|
11
|
-
|
|
12
|
-
export { HomePage };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { Opinly } from '@opinly/backend';
|
|
3
|
-
|
|
4
|
-
type HomePage = Extract<Awaited<ReturnType<Opinly["content"]["blog"]>>, {
|
|
5
|
-
type: "home";
|
|
6
|
-
}>["data"];
|
|
7
|
-
declare const HomePage: ({ homePage, page, }: {
|
|
8
|
-
homePage: HomePage;
|
|
9
|
-
page: number | null | undefined;
|
|
10
|
-
}) => react_jsx_runtime.JSX.Element;
|
|
11
|
-
|
|
12
|
-
export { HomePage };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import Link from "next/link";
|
|
3
|
-
import { PostPreview } from "./post-preview";
|
|
4
|
-
const HomePage = ({
|
|
5
|
-
homePage,
|
|
6
|
-
page
|
|
7
|
-
}) => {
|
|
8
|
-
const { posts, folders, count } = homePage;
|
|
9
|
-
console.log("posts", JSON.stringify(posts, null, 2));
|
|
10
|
-
const currentPage = page;
|
|
11
|
-
const totalPages = Math.ceil(count / 10);
|
|
12
|
-
return /* @__PURE__ */ jsxs("div", { className: "max-w-7xl mx-auto px-4 py-10", children: [
|
|
13
|
-
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-10", children: posts.map((post) => /* @__PURE__ */ jsx(PostPreview, { post }, post.slug)) }),
|
|
14
|
-
/* @__PURE__ */ jsx("div", { className: "flex justify-center items-center mt-10 gap-2", children: Array.from({ length: totalPages }, (_, i) => i + 1).map((p) => /* @__PURE__ */ jsx(
|
|
15
|
-
Link,
|
|
16
|
-
{
|
|
17
|
-
href: `?page=${p}`,
|
|
18
|
-
className: `px-3 py-1 border rounded ${p === currentPage ? "bg-black text-white" : "hover:bg-gray-100 text-gray-700"}`,
|
|
19
|
-
children: p
|
|
20
|
-
},
|
|
21
|
-
p
|
|
22
|
-
)) }),
|
|
23
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2 mb-10", children: folders.map((folder) => /* @__PURE__ */ jsx(
|
|
24
|
-
Link,
|
|
25
|
-
{
|
|
26
|
-
href: `/blog/${folder.slug}`,
|
|
27
|
-
className: "px-4 py-1 bg-gray-100 text-sm rounded-full hover:bg-gray-200",
|
|
28
|
-
children: folder.title
|
|
29
|
-
},
|
|
30
|
-
folder.slug
|
|
31
|
-
)) })
|
|
32
|
-
] });
|
|
33
|
-
};
|
|
34
|
-
export {
|
|
35
|
-
HomePage
|
|
36
|
-
};
|
|
37
|
-
//# sourceMappingURL=home-page.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/home-page.tsx"],"sourcesContent":["import Link from \"next/link\";\n\nimport { Opinly } from \"@opinly/backend\";\nimport { PostPreview } from \"./post-preview\";\n\ntype HomePage = Extract<\n Awaited<ReturnType<Opinly[\"content\"][\"blog\"]>>,\n { type: \"home\" }\n>[\"data\"];\n\nexport const HomePage = ({\n homePage,\n page,\n}: {\n homePage: HomePage;\n page: number | null | undefined;\n}) => {\n const { posts, folders, count } = homePage;\n\n console.log(\"posts\", JSON.stringify(posts, null, 2));\n\n const currentPage = page;\n const totalPages = Math.ceil(count / 10);\n\n return (\n <div className=\"max-w-7xl mx-auto px-4 py-10\">\n {/* Posts Grid */}\n <div className=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-10\">\n {posts.map((post) => (\n <PostPreview key={post.slug} post={post} />\n ))}\n </div>\n\n {/* Pagination */}\n <div className=\"flex justify-center items-center mt-10 gap-2\">\n {Array.from({ length: totalPages }, (_, i) => i + 1).map((p) => (\n <Link\n key={p}\n href={`?page=${p}`}\n className={`px-3 py-1 border rounded ${\n p === currentPage\n ? \"bg-black text-white\"\n : \"hover:bg-gray-100 text-gray-700\"\n }`}\n >\n {p}\n </Link>\n ))}\n </div>\n\n {/* Folder tags */}\n <div className=\"flex flex-wrap gap-2 mb-10\">\n {folders.map((folder) => (\n <Link\n key={folder.slug}\n href={`/blog/${folder.slug}`}\n className=\"px-4 py-1 bg-gray-100 text-sm rounded-full hover:bg-gray-200\"\n >\n {folder.title}\n </Link>\n ))}\n </div>\n </div>\n );\n};\n"],"mappings":"AAyBI,SAIM,KAJN;AAzBJ,OAAO,UAAU;AAGjB,SAAS,mBAAmB;AAOrB,MAAM,WAAW,CAAC;AAAA,EACvB;AAAA,EACA;AACF,MAGM;AACJ,QAAM,EAAE,OAAO,SAAS,MAAM,IAAI;AAElC,UAAQ,IAAI,SAAS,KAAK,UAAU,OAAO,MAAM,CAAC,CAAC;AAEnD,QAAM,cAAc;AACpB,QAAM,aAAa,KAAK,KAAK,QAAQ,EAAE;AAEvC,SACE,qBAAC,SAAI,WAAU,gCAEb;AAAA,wBAAC,SAAI,WAAU,yDACZ,gBAAM,IAAI,CAAC,SACV,oBAAC,eAA4B,QAAX,KAAK,IAAkB,CAC1C,GACH;AAAA,IAGA,oBAAC,SAAI,WAAU,gDACZ,gBAAM,KAAK,EAAE,QAAQ,WAAW,GAAG,CAAC,GAAG,MAAM,IAAI,CAAC,EAAE,IAAI,CAAC,MACxD;AAAA,MAAC;AAAA;AAAA,QAEC,MAAM,SAAS,CAAC;AAAA,QAChB,WAAW,4BACT,MAAM,cACF,wBACA,iCACN;AAAA,QAEC;AAAA;AAAA,MARI;AAAA,IASP,CACD,GACH;AAAA,IAGA,oBAAC,SAAI,WAAU,8BACZ,kBAAQ,IAAI,CAAC,WACZ;AAAA,MAAC;AAAA;AAAA,QAEC,MAAM,SAAS,OAAO,IAAI;AAAA,QAC1B,WAAU;AAAA,QAET,iBAAO;AAAA;AAAA,MAJH,OAAO;AAAA,IAKd,CACD,GACH;AAAA,KACF;AAEJ;","names":[]}
|
package/dist/utils/images.cjs
DELETED
|
@@ -1,35 +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 images_exports = {};
|
|
20
|
-
__export(images_exports, {
|
|
21
|
-
replaceImageNameSpace: () => replaceImageNameSpace
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(images_exports);
|
|
24
|
-
function replaceImageNameSpace(fileKey) {
|
|
25
|
-
const pathParts = fileKey.split("/").filter(Boolean);
|
|
26
|
-
if (pathParts.length > 1) {
|
|
27
|
-
pathParts.shift();
|
|
28
|
-
}
|
|
29
|
-
return pathParts.join("/");
|
|
30
|
-
}
|
|
31
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
-
0 && (module.exports = {
|
|
33
|
-
replaceImageNameSpace
|
|
34
|
-
});
|
|
35
|
-
//# sourceMappingURL=images.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/images.ts"],"sourcesContent":["export function replaceImageNameSpace(fileKey: string) {\n const pathParts = fileKey.split(\"/\").filter(Boolean);\n if (pathParts.length > 1) {\n pathParts.shift();\n }\n return pathParts.join(\"/\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,SAAS,sBAAsB,SAAiB;AACrD,QAAM,YAAY,QAAQ,MAAM,GAAG,EAAE,OAAO,OAAO;AACnD,MAAI,UAAU,SAAS,GAAG;AACxB,cAAU,MAAM;AAAA,EAClB;AACA,SAAO,UAAU,KAAK,GAAG;AAC3B;","names":[]}
|
package/dist/utils/images.d.cts
DELETED
package/dist/utils/images.d.ts
DELETED
package/dist/utils/images.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
function replaceImageNameSpace(fileKey) {
|
|
2
|
-
const pathParts = fileKey.split("/").filter(Boolean);
|
|
3
|
-
if (pathParts.length > 1) {
|
|
4
|
-
pathParts.shift();
|
|
5
|
-
}
|
|
6
|
-
return pathParts.join("/");
|
|
7
|
-
}
|
|
8
|
-
export {
|
|
9
|
-
replaceImageNameSpace
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=images.js.map
|
package/dist/utils/images.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/images.ts"],"sourcesContent":["export function replaceImageNameSpace(fileKey: string) {\n const pathParts = fileKey.split(\"/\").filter(Boolean);\n if (pathParts.length > 1) {\n pathParts.shift();\n }\n return pathParts.join(\"/\");\n}\n"],"mappings":"AAAO,SAAS,sBAAsB,SAAiB;AACrD,QAAM,YAAY,QAAQ,MAAM,GAAG,EAAE,OAAO,OAAO;AACnD,MAAI,UAAU,SAAS,GAAG;AACxB,cAAU,MAAM;AAAA,EAClB;AACA,SAAO,UAAU,KAAK,GAAG;AAC3B;","names":[]}
|