|
| 1 | +import type { ReactNode } from 'react'; |
| 2 | + |
| 3 | +export type BlogArticleShellProps = { |
| 4 | + children: ReactNode; |
| 5 | + /** default = subtle card wrap; feature = dark hero band + tags */ |
| 6 | + variant?: 'default' | 'feature'; |
| 7 | + hero?: { |
| 8 | + eyebrow?: string; |
| 9 | + subtitle?: string; |
| 10 | + tags?: string[]; |
| 11 | + }; |
| 12 | +}; |
| 13 | + |
| 14 | +/** |
| 15 | + * Wraps blog article HTML/TSX bodies for richer layouts than flat markdown prose. |
| 16 | + */ |
| 17 | +export default function BlogArticleShell({ children, variant = 'default', hero }: BlogArticleShellProps) { |
| 18 | + if (variant === 'feature' && hero) { |
| 19 | + return ( |
| 20 | + <div className="blog-article-shell blog-article-shell--feature"> |
| 21 | + <div |
| 22 | + className="blog-article-shell-hero" |
| 23 | + style={{ |
| 24 | + margin: '-0.25rem -0.5rem 1.75rem', |
| 25 | + padding: '2rem 1.25rem 1.75rem', |
| 26 | + borderRadius: 'var(--pts-card-radius)', |
| 27 | + background: 'linear-gradient(135deg, var(--pts-nav-bg) 0%, var(--pts-surface-dark-raised) 55%, var(--pts-dashboard-bg) 100%)', |
| 28 | + border: '1px solid rgba(0, 223, 130, 0.2)', |
| 29 | + boxShadow: 'var(--pts-shadow-lp)', |
| 30 | + }} |
| 31 | + > |
| 32 | + {hero.eyebrow && ( |
| 33 | + <p |
| 34 | + style={{ |
| 35 | + fontSize: '0.72rem', |
| 36 | + letterSpacing: '0.14em', |
| 37 | + textTransform: 'uppercase', |
| 38 | + color: 'var(--pts-accent)', |
| 39 | + fontWeight: 700, |
| 40 | + marginBottom: '0.75rem', |
| 41 | + }} |
| 42 | + > |
| 43 | + {hero.eyebrow} |
| 44 | + </p> |
| 45 | + )} |
| 46 | + {hero.subtitle && ( |
| 47 | + <p |
| 48 | + style={{ |
| 49 | + fontSize: '1.05rem', |
| 50 | + lineHeight: 1.65, |
| 51 | + color: 'rgba(255,255,255,0.86)', |
| 52 | + maxWidth: '44rem', |
| 53 | + fontWeight: 500, |
| 54 | + }} |
| 55 | + > |
| 56 | + {hero.subtitle} |
| 57 | + </p> |
| 58 | + )} |
| 59 | + {hero.tags && hero.tags.length > 0 && ( |
| 60 | + <div style={{ display: 'flex', flexWrap: 'wrap', gap: '0.45rem', marginTop: '1.1rem' }}> |
| 61 | + {hero.tags.map((t) => ( |
| 62 | + <span |
| 63 | + key={t} |
| 64 | + style={{ |
| 65 | + fontSize: '0.68rem', |
| 66 | + letterSpacing: '0.06em', |
| 67 | + textTransform: 'uppercase', |
| 68 | + padding: '0.25rem 0.6rem', |
| 69 | + borderRadius: '999px', |
| 70 | + background: 'rgba(0, 223, 130, 0.12)', |
| 71 | + color: 'var(--pts-accent)', |
| 72 | + border: '1px solid rgba(0, 223, 130, 0.28)', |
| 73 | + }} |
| 74 | + > |
| 75 | + {t} |
| 76 | + </span> |
| 77 | + ))} |
| 78 | + </div> |
| 79 | + )} |
| 80 | + </div> |
| 81 | + <div |
| 82 | + className="blog-article-shell-body" |
| 83 | + style={{ |
| 84 | + padding: '0.25rem 0.15rem 0.5rem', |
| 85 | + }} |
| 86 | + > |
| 87 | + {children} |
| 88 | + </div> |
| 89 | + </div> |
| 90 | + ); |
| 91 | + } |
| 92 | + |
| 93 | + return ( |
| 94 | + <div |
| 95 | + className="blog-article-shell blog-article-shell--default" |
| 96 | + style={{ |
| 97 | + padding: '1.25rem 1.25rem 1.5rem', |
| 98 | + borderRadius: 'var(--pts-card-radius)', |
| 99 | + background: 'linear-gradient(180deg, var(--pts-tech-header) 0%, var(--pts-card-bg) 35%)', |
| 100 | + border: '1px solid var(--pts-border)', |
| 101 | + boxShadow: 'var(--pts-shadow-lp)', |
| 102 | + }} |
| 103 | + > |
| 104 | + {children} |
| 105 | + </div> |
| 106 | + ); |
| 107 | +} |
0 commit comments