@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/package.json
CHANGED
package/src/ArticleCard.tsx
CHANGED
|
@@ -32,11 +32,11 @@ export function ArticleCard({ article, config }: ArticleCardProps) {
|
|
|
32
32
|
{article.category}
|
|
33
33
|
</span>
|
|
34
34
|
</div>
|
|
35
|
-
<h3
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
>
|
|
35
|
+
<h3
|
|
36
|
+
className="text-lg font-semibold leading-none tracking-tight mb-2"
|
|
37
|
+
style={{ fontFamily: config?.theme?.headerFontFamily }}
|
|
38
|
+
>
|
|
39
|
+
<Link href={`/articles/${article.slug}`} className="hover:text-primary transition-colors">
|
|
40
40
|
{article.title}
|
|
41
41
|
</Link>
|
|
42
42
|
</h3>
|
|
@@ -3,6 +3,7 @@ import Image from 'next/image'
|
|
|
3
3
|
import Link from 'next/link'
|
|
4
4
|
import { Calendar, Clock, User } from 'lucide-react'
|
|
5
5
|
import type { Article, AuthorProfile } from './articleTypes'
|
|
6
|
+
import type { ArticlesConfig } from './articlesConfig'
|
|
6
7
|
|
|
7
8
|
type ArticleDetailHeroProps = Readonly<{
|
|
8
9
|
article: Article
|
|
@@ -10,6 +11,8 @@ type ArticleDetailHeroProps = Readonly<{
|
|
|
10
11
|
showDate?: boolean
|
|
11
12
|
showAuthor?: boolean
|
|
12
13
|
authors?: AuthorProfile[]
|
|
14
|
+
/** Optional - when `config.theme.headerFontFamily` is set, applies it to the title. */
|
|
15
|
+
config?: ArticlesConfig
|
|
13
16
|
}>
|
|
14
17
|
|
|
15
18
|
function toSlug(cat: string): string {
|
|
@@ -25,6 +28,7 @@ export function ArticleDetailHero({
|
|
|
25
28
|
showDate = false,
|
|
26
29
|
showAuthor = true,
|
|
27
30
|
authors = [],
|
|
31
|
+
config,
|
|
28
32
|
}: ArticleDetailHeroProps) {
|
|
29
33
|
const showConfiguredAuthors = showAuthor && authors.length > 0
|
|
30
34
|
const showLegacyAuthor = showAuthor && authors.length === 0 && article.author.trim().length > 0
|
|
@@ -98,7 +102,12 @@ export function ArticleDetailHero({
|
|
|
98
102
|
)}
|
|
99
103
|
</div>
|
|
100
104
|
)}
|
|
101
|
-
<h1
|
|
105
|
+
<h1
|
|
106
|
+
className="text-4xl md:text-5xl font-bold mb-4"
|
|
107
|
+
style={{ fontFamily: config?.theme?.headerFontFamily }}
|
|
108
|
+
>
|
|
109
|
+
{article.title}
|
|
110
|
+
</h1>
|
|
102
111
|
<div
|
|
103
112
|
style={{
|
|
104
113
|
display: 'flex',
|
package/src/ArticlesPage.tsx
CHANGED
|
@@ -36,6 +36,7 @@ function buildThemeVars(theme?: ArticlesTheme): React.CSSProperties {
|
|
|
36
36
|
if (!theme) return {}
|
|
37
37
|
const vars: Record<string, string> = {}
|
|
38
38
|
if (theme.fontFamily) vars['--articles-font-family'] = theme.fontFamily
|
|
39
|
+
if (theme.headerFontFamily) vars['--articles-header-font-family'] = theme.headerFontFamily
|
|
39
40
|
if (theme.headerColor) vars['--articles-header-color'] = theme.headerColor
|
|
40
41
|
if (theme.textColor) vars['--articles-text-color'] = theme.textColor
|
|
41
42
|
if (theme.backgroundColor) vars['--articles-bg-color'] = theme.backgroundColor
|
|
@@ -29,7 +29,10 @@ export function RelatedArticlesSection({
|
|
|
29
29
|
|
|
30
30
|
return (
|
|
31
31
|
<section className="mt-12 pt-8 border-t border-border" aria-label="Related articles">
|
|
32
|
-
<h2
|
|
32
|
+
<h2
|
|
33
|
+
className="text-xl font-semibold text-foreground mb-6"
|
|
34
|
+
style={{ fontFamily: config?.theme?.headerFontFamily }}
|
|
35
|
+
>
|
|
33
36
|
{heading ?? `More in ${category}`}
|
|
34
37
|
</h2>
|
|
35
38
|
<div className="grid gap-6 sm:grid-cols-2 lg:grid-cols-3">
|
package/src/articlesConfig.ts
CHANGED
|
@@ -18,6 +18,14 @@ export type ArticlesSection =
|
|
|
18
18
|
export interface ArticlesTheme {
|
|
19
19
|
/** Font family for the articles section. Example: `"'Inter', sans-serif"` */
|
|
20
20
|
fontFamily?: string
|
|
21
|
+
/**
|
|
22
|
+
* Font family for headings only (article title, card titles, section
|
|
23
|
+
* headings) - falls back to `fontFamily` when omitted. Lets a site use a
|
|
24
|
+
* distinct display face for headings (e.g. a serif) while keeping a
|
|
25
|
+
* separate body font, without hardcoding either into the package.
|
|
26
|
+
* Example: `"'Cinzel', serif"`
|
|
27
|
+
*/
|
|
28
|
+
headerFontFamily?: string
|
|
21
29
|
/** Color for article card titles and section headings. Example: `'#111827'` */
|
|
22
30
|
headerColor?: string
|
|
23
31
|
/** Color for body and excerpt text. Example: `'#6b7280'` */
|