@fullstackdatasolutions/articles 1.0.0 → 1.1.0
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/CHANGELOG.md +10 -0
- package/README.md +9 -8
- package/dist/index.cjs +28 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +28 -9
- package/dist/index.js.map +1 -1
- package/dist/nextjs.d.cts +8 -0
- package/dist/nextjs.d.ts +8 -0
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +8 -0
- package/dist/server.d.ts +8 -0
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
- package/src/ArticleCard.tsx +5 -5
- package/src/ArticleDetailHero.tsx +10 -1
- package/src/ArticlesPage.tsx +1 -0
- package/src/RelatedArticlesSection.tsx +4 -1
- package/src/articlesConfig.ts +8 -0
package/dist/index.d.cts
CHANGED
|
@@ -232,6 +232,14 @@ type ArticlesSection = 'hero' | 'search' | 'featured' | 'latest' | 'categories'
|
|
|
232
232
|
interface ArticlesTheme {
|
|
233
233
|
/** Font family for the articles section. Example: `"'Inter', sans-serif"` */
|
|
234
234
|
fontFamily?: string;
|
|
235
|
+
/**
|
|
236
|
+
* Font family for headings only (article title, card titles, section
|
|
237
|
+
* headings) - falls back to `fontFamily` when omitted. Lets a site use a
|
|
238
|
+
* distinct display face for headings (e.g. a serif) while keeping a
|
|
239
|
+
* separate body font, without hardcoding either into the package.
|
|
240
|
+
* Example: `"'Cinzel', serif"`
|
|
241
|
+
*/
|
|
242
|
+
headerFontFamily?: string;
|
|
235
243
|
/** Color for article card titles and section headings. Example: `'#111827'` */
|
|
236
244
|
headerColor?: string;
|
|
237
245
|
/** Color for body and excerpt text. Example: `'#6b7280'` */
|
|
@@ -453,8 +461,10 @@ type ArticleDetailHeroProps = Readonly<{
|
|
|
453
461
|
showDate?: boolean;
|
|
454
462
|
showAuthor?: boolean;
|
|
455
463
|
authors?: AuthorProfile[];
|
|
464
|
+
/** Optional - when `config.theme.headerFontFamily` is set, applies it to the title. */
|
|
465
|
+
config?: ArticlesConfig;
|
|
456
466
|
}>;
|
|
457
|
-
declare function ArticleDetailHero({ article, categoryBasePath, showDate, showAuthor, authors, }: ArticleDetailHeroProps): react_jsx_runtime.JSX.Element;
|
|
467
|
+
declare function ArticleDetailHero({ article, categoryBasePath, showDate, showAuthor, authors, config, }: ArticleDetailHeroProps): react_jsx_runtime.JSX.Element;
|
|
458
468
|
|
|
459
469
|
type ArticleSearchBarProps = Readonly<{
|
|
460
470
|
value: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -232,6 +232,14 @@ type ArticlesSection = 'hero' | 'search' | 'featured' | 'latest' | 'categories'
|
|
|
232
232
|
interface ArticlesTheme {
|
|
233
233
|
/** Font family for the articles section. Example: `"'Inter', sans-serif"` */
|
|
234
234
|
fontFamily?: string;
|
|
235
|
+
/**
|
|
236
|
+
* Font family for headings only (article title, card titles, section
|
|
237
|
+
* headings) - falls back to `fontFamily` when omitted. Lets a site use a
|
|
238
|
+
* distinct display face for headings (e.g. a serif) while keeping a
|
|
239
|
+
* separate body font, without hardcoding either into the package.
|
|
240
|
+
* Example: `"'Cinzel', serif"`
|
|
241
|
+
*/
|
|
242
|
+
headerFontFamily?: string;
|
|
235
243
|
/** Color for article card titles and section headings. Example: `'#111827'` */
|
|
236
244
|
headerColor?: string;
|
|
237
245
|
/** Color for body and excerpt text. Example: `'#6b7280'` */
|
|
@@ -453,8 +461,10 @@ type ArticleDetailHeroProps = Readonly<{
|
|
|
453
461
|
showDate?: boolean;
|
|
454
462
|
showAuthor?: boolean;
|
|
455
463
|
authors?: AuthorProfile[];
|
|
464
|
+
/** Optional - when `config.theme.headerFontFamily` is set, applies it to the title. */
|
|
465
|
+
config?: ArticlesConfig;
|
|
456
466
|
}>;
|
|
457
|
-
declare function ArticleDetailHero({ article, categoryBasePath, showDate, showAuthor, authors, }: ArticleDetailHeroProps): react_jsx_runtime.JSX.Element;
|
|
467
|
+
declare function ArticleDetailHero({ article, categoryBasePath, showDate, showAuthor, authors, config, }: ArticleDetailHeroProps): react_jsx_runtime.JSX.Element;
|
|
458
468
|
|
|
459
469
|
type ArticleSearchBarProps = Readonly<{
|
|
460
470
|
value: string;
|
package/dist/index.js
CHANGED
|
@@ -589,6 +589,7 @@ function emitArticleEvent(handler, event) {
|
|
|
589
589
|
// src/ArticleCard.tsx
|
|
590
590
|
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
591
591
|
function ArticleCard({ article, config }) {
|
|
592
|
+
var _a;
|
|
592
593
|
return /* @__PURE__ */ jsxs8("div", { className: "rounded-lg border border-border bg-card text-card-foreground shadow-sm hover:shadow-lg transition-shadow duration-300", children: [
|
|
593
594
|
/* @__PURE__ */ jsx8("div", { className: "p-0", children: /* @__PURE__ */ jsx8(
|
|
594
595
|
Image4,
|
|
@@ -602,14 +603,14 @@ function ArticleCard({ article, config }) {
|
|
|
602
603
|
) }),
|
|
603
604
|
/* @__PURE__ */ jsxs8("div", { className: "p-6", children: [
|
|
604
605
|
/* @__PURE__ */ jsx8("div", { className: "flex gap-2 mb-3", children: /* @__PURE__ */ jsx8("span", { className: "bg-primary/10 text-primary text-xs font-medium px-2 py-1 rounded", children: article.category }) }),
|
|
605
|
-
/* @__PURE__ */ jsx8(
|
|
606
|
-
|
|
606
|
+
/* @__PURE__ */ jsx8(
|
|
607
|
+
"h3",
|
|
607
608
|
{
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
children: article.title
|
|
609
|
+
className: "text-lg font-semibold leading-none tracking-tight mb-2",
|
|
610
|
+
style: { fontFamily: (_a = config == null ? void 0 : config.theme) == null ? void 0 : _a.headerFontFamily },
|
|
611
|
+
children: /* @__PURE__ */ jsx8(Link6, { href: `/articles/${article.slug}`, className: "hover:text-primary transition-colors", children: article.title })
|
|
611
612
|
}
|
|
612
|
-
)
|
|
613
|
+
),
|
|
613
614
|
/* @__PURE__ */ jsx8("p", { className: "text-muted-foreground mb-4 line-clamp-3", children: article.excerpt }),
|
|
614
615
|
article.authorSlug && /* @__PURE__ */ jsxs8(
|
|
615
616
|
Link6,
|
|
@@ -932,6 +933,7 @@ function buildThemeVars(theme) {
|
|
|
932
933
|
if (!theme) return {};
|
|
933
934
|
const vars = {};
|
|
934
935
|
if (theme.fontFamily) vars["--articles-font-family"] = theme.fontFamily;
|
|
936
|
+
if (theme.headerFontFamily) vars["--articles-header-font-family"] = theme.headerFontFamily;
|
|
935
937
|
if (theme.headerColor) vars["--articles-header-color"] = theme.headerColor;
|
|
936
938
|
if (theme.textColor) vars["--articles-text-color"] = theme.textColor;
|
|
937
939
|
if (theme.backgroundColor) vars["--articles-bg-color"] = theme.backgroundColor;
|
|
@@ -1097,8 +1099,10 @@ function ArticleDetailHero({
|
|
|
1097
1099
|
categoryBasePath = "/articles/category",
|
|
1098
1100
|
showDate = false,
|
|
1099
1101
|
showAuthor = true,
|
|
1100
|
-
authors = []
|
|
1102
|
+
authors = [],
|
|
1103
|
+
config
|
|
1101
1104
|
}) {
|
|
1105
|
+
var _a;
|
|
1102
1106
|
const showConfiguredAuthors = showAuthor && authors.length > 0;
|
|
1103
1107
|
const showLegacyAuthor = showAuthor && authors.length === 0 && article.author.trim().length > 0;
|
|
1104
1108
|
return /* @__PURE__ */ jsxs13(
|
|
@@ -1179,7 +1183,14 @@ function ArticleDetailHero({
|
|
|
1179
1183
|
)
|
|
1180
1184
|
}
|
|
1181
1185
|
),
|
|
1182
|
-
/* @__PURE__ */ jsx13(
|
|
1186
|
+
/* @__PURE__ */ jsx13(
|
|
1187
|
+
"h1",
|
|
1188
|
+
{
|
|
1189
|
+
className: "text-4xl md:text-5xl font-bold mb-4",
|
|
1190
|
+
style: { fontFamily: (_a = config == null ? void 0 : config.theme) == null ? void 0 : _a.headerFontFamily },
|
|
1191
|
+
children: article.title
|
|
1192
|
+
}
|
|
1193
|
+
),
|
|
1183
1194
|
/* @__PURE__ */ jsxs13(
|
|
1184
1195
|
"div",
|
|
1185
1196
|
{
|
|
@@ -1945,9 +1956,17 @@ function RelatedArticlesSection({
|
|
|
1945
1956
|
fromSlug,
|
|
1946
1957
|
source = "category"
|
|
1947
1958
|
}) {
|
|
1959
|
+
var _a;
|
|
1948
1960
|
if (articles.length === 0) return null;
|
|
1949
1961
|
return /* @__PURE__ */ jsxs20("section", { className: "mt-12 pt-8 border-t border-border", "aria-label": "Related articles", children: [
|
|
1950
|
-
/* @__PURE__ */ jsx21(
|
|
1962
|
+
/* @__PURE__ */ jsx21(
|
|
1963
|
+
"h2",
|
|
1964
|
+
{
|
|
1965
|
+
className: "text-xl font-semibold text-foreground mb-6",
|
|
1966
|
+
style: { fontFamily: (_a = config == null ? void 0 : config.theme) == null ? void 0 : _a.headerFontFamily },
|
|
1967
|
+
children: heading != null ? heading : `More in ${category}`
|
|
1968
|
+
}
|
|
1969
|
+
),
|
|
1951
1970
|
/* @__PURE__ */ jsx21("div", { className: "grid gap-6 sm:grid-cols-2 lg:grid-cols-3", children: articles.map((article) => /* @__PURE__ */ jsx21(
|
|
1952
1971
|
"div",
|
|
1953
1972
|
{
|