Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(docsite): restore blog styling lost in #3001 (#3033)

rubyycheunga0239d67e3b4
diff --git a/apps/docsite/src/components/blog/AuthorByline.tsx b/apps/docsite/src/components/blog/AuthorByline.tsx
index c783954527..8c9a4b0b52 100644
--- a/apps/docsite/src/components/blog/AuthorByline.tsx
+++ b/apps/docsite/src/components/blog/AuthorByline.tsx
@@ -2,21 +2,13 @@
/**
* @file AuthorByline.tsx
- *
- * Renders one or more resolved authors with avatars, plus optional publish/
- * updated dates and reading time. Used on blog cards (compact) and at the top of
- * article pages (full).
- *
- * @input author keys, date, optional updatedAt, optional readingTimeMinutes
- * @output A horizontal byline row
- * @position Used by BlogCard and the article header
+ * Blog byline: publish/updated date and reading time.
*/
import * as stylex from '@stylexjs/stylex';
-import {Avatar} from '@astryxdesign/core/Avatar';
import {Text} from '@astryxdesign/core/Text';
import {HStack} from '@astryxdesign/core/Layout';
-import {resolveAuthor} from '../../content/blog/authors';
+import {Divider} from '@astryxdesign/core/Divider';
export function formatDate(iso: string): string {
// Parse as UTC to avoid off-by-one from local timezones.
@@ -33,61 +25,35 @@ export function formatDate(iso: string): string {
}
const styles = stylex.create({
- names: {
- display: 'inline',
- },
- dot: {
- opacity: 0.5,
+ divider: {
+ height: '0.75em',
},
});
export interface AuthorBylineProps {
- authors: string[];
date: string;
updatedAt?: string | null;
readingTimeMinutes?: number;
- /** 'compact' for cards, 'full' for article headers. */
variant?: 'compact' | 'full';
+ className?: string;
}
export function AuthorByline({
- authors,
date,
updatedAt,
readingTimeMinutes,
variant = 'compact',
+ className,
}: AuthorBylineProps) {
- const resolved = authors.map(resolveAuthor);
- const avatarSize = variant === 'full' ? 'small' : 'tiny';
- const names = resolved.map(a => a.name).join(', ');
-
return (
- <HStack gap={2} align="center">
- <HStack gap={0} align="center">
- {resolved.map(author => (
- <Avatar
- key={author.key}
- src={author.avatar}
- name={author.name}
- size={avatarSize}
- />
- ))}
- </HStack>
- <HStack gap={1} align="center">
- <Text type="supporting" color="secondary">
- {names}
- </Text>
- <Text type="supporting" color="secondary" xstyle={styles.dot}>
- ·
- </Text>
+ <HStack gap={2} align="center" className={className}>
+ <HStack gap={2} align="center">
<Text type="supporting" color="secondary">
{formatDate(date)}
</Text>
{variant === 'full' && updatedAt ? (
<>
- <Text type="supporting" color="secondary" xstyle={styles.dot}>
- ·
- </Text>
+ <Divider orientation="vertical" xstyle={styles.divider} />
<Text type="supporting" color="secondary">
Updated {formatDate(updatedAt)}
</Text>
@@ -95,9 +61,7 @@ export function AuthorByline({
) : null}
{readingTimeMinutes ? (
<>
- <Text type="supporting" color="secondary" xstyle={styles.dot}>
- ·
- </Text>
+ <Divider orientation="vertical" xstyle={styles.divider} />
<Text type="supporting" color="secondary">
{readingTimeMinutes} min read
</Text>
diff --git a/apps/docsite/src/components/blog/BlogArticle.tsx b/apps/docsite/src/components/blog/BlogArticle.tsx
index 1670a87c3a..6608f4c5ac 100644
--- a/apps/docsite/src/components/blog/BlogArticle.tsx
+++ b/apps/docsite/src/components/blog/BlogArticle.tsx
@@ -2,16 +2,7 @@
/**
* @file BlogArticle.tsx
- *
- * Article layout matching the docs page typography: a centered, readable column
- * with a breadcrumb trail (Blog / post type), a display-1 title, large
- * regular-weight dek, byline, a neutral cover placeholder, the prose body
- * (rendered via Markdown), optional curated related-doc links, and a link back to
- * the blog index. No sidebar.
- *
- * @input post (BlogPost)
- * @output The full article view
- * @position Rendered by app/blog/[slug]/page.tsx
+ * Full blog post layout: breadcrumb, title, byline, cover, prose, related docs.
*/
import * as stylex from '@stylexjs/stylex';
@@ -35,13 +26,11 @@ const styles = stylex.create({
section: {
marginInline: 'auto',
},
- // Shared cover frame (calm, theme-driven). AspectRatio governs the ratio.
cover: {
borderRadius: 'var(--radius-container)',
backgroundColor: 'var(--color-background-muted)',
border: '1px solid var(--color-border)',
},
- // Neutral placeholder shown when no cover image is provided.
coverPlaceholder: {
width: '100%',
aspectRatio: '16 / 9',
@@ -63,9 +52,11 @@ export interface BlogArticleProps {
export function BlogArticle({post}: BlogArticleProps) {
return (
- <Section maxWidth={layout.proseMaxWidth} padding={6} xstyle={styles.section}>
+ <Section
+ maxWidth={layout.proseMaxWidth}
+ padding={6}
+ xstyle={styles.section}>
<VStack gap={10}>
- {/* Header — matches the docs page treatment */}
<VStack gap={4}>
<Breadcrumbs>
<BreadcrumbItem href="/blog">Blog</BreadcrumbItem>
@@ -80,7 +71,6 @@ export function BlogArticle({post}: BlogArticleProps) {
{post.description}
</Text>
<AuthorByline
- authors={post.authors}
date={post.date}
updatedAt={post.updatedAt}
readingTimeMinutes={post.readingTimeMinutes}
@@ -89,7 +79,6 @@ export function BlogArticle({post}: BlogArticleProps) {
<Divider />
</VStack>
- {/* Cover — custom image when provided, else a neutral placeholder */}
{post.coverImage ? (
<AspectRatio ratio={16 / 9} xstyle={styles.cover}>
<img
@@ -105,7 +94,6 @@ export function BlogArticle({post}: BlogArticleProps) {
/>
)}
- {/* Body */}
<Markdown headingLevelStart={2}>{post.body}</Markdown>
{post.tags.length > 0 ? (
@@ -116,7 +104,6 @@ export function BlogArticle({post}: BlogArticleProps) {
</HStack>
) : null}
- {/* Related content */}
{post.relatedDocs && post.relatedDocs.length > 0 ? (
<VStack gap={6}>
<Divider />
diff --git a/apps/docsite/src/components/blog/BlogCard.tsx b/apps/docsite/src/components/blog/BlogCard.tsx
index 91fa73d4ec..a89d634179 100644
--- a/apps/docsite/src/components/blog/BlogCard.tsx
+++ b/apps/docsite/src/components/blog/BlogCard.tsx
@@ -2,50 +2,47 @@
/**
* @file BlogCard.tsx
- *
- * A blog index card built on ClickableCard: a neutral
- * cover placeholder on top, then type badge, title, description excerpt,
- * byline, and tag chips. The whole card navigates to the post; nested elements
- * (tags, author links) remain independently interactive.
- *
- * The `feature` variant gives the latest post a larger treatment. This is
- * derived from sort order by the index page — never from per-post metadata.
- *
- * @input post (BlogPost), feature flag
- * @output A clickable card for the blog grid
- * @position Used by the /blog index grid
+ * Blog index card: cover, title, excerpt, byline, and a type + tags chip row.
+ * The `feature` variant (latest post) renders larger.
*/
import * as stylex from '@stylexjs/stylex';
import {Text, Heading} from '@astryxdesign/core/Text';
import {VStack, HStack} from '@astryxdesign/core/Layout';
import {Badge} from '@astryxdesign/core/Badge';
-import {ClickableCard} from '@astryxdesign/core/ClickableCard';
+import {Link} from '@astryxdesign/core/Link';
+import {AspectRatio} from '@astryxdesign/core/AspectRatio';
import type {BlogPost} from '../../lib/blog/schema';
import {POST_TYPE_LABELS} from '../../lib/blog/schema';
import {AuthorByline} from './AuthorByline';
+import css from './BlogCard.module.css';
const styles = stylex.create({
card: {
+ display: 'block',
+ width: '100%',
height: '100%',
+ color: 'inherit',
+ textDecoration: {
+ default: 'none',
+ ':hover': 'none',
+ },
},
inner: {
height: '100%',
},
- // Neutral cover placeholder (cover generator deferred). Calm, theme-driven.
- cover: (feature: boolean) => ({
- width: '100%',
- aspectRatio: feature ? '16 / 7' : '16 / 9',
+ // Hover tint lives in BlogCard.module.css (.cover::after).
+ cover: {
borderRadius: 'var(--radius-container)',
backgroundColor: 'var(--color-background-muted)',
border: '1px solid var(--color-border)',
- }),
+ overflow: 'hidden',
+ },
coverImg: {
width: '100%',
height: '100%',
objectFit: 'cover',
display: 'block',
- borderRadius: 'var(--radius-container)',
},
excerpt: {
display: '-webkit-box',
@@ -53,7 +50,7 @@ const styles = stylex.create({
WebkitBoxOrient: 'vertical',
overflow: 'hidden',
},
- tagRow: {
+ postTags: {
flexWrap: 'wrap',
},
});
@@ -65,46 +62,50 @@ export interface BlogCardProps {
export function BlogCard({post, feature = false}: BlogCardProps) {
return (
- <ClickableCard
+ <Link
href={`/blog/${post.slug}`}
label={post.title}
- padding={4}
- xstyle={styles.card}>
+ color="inherit"
+ display="block"
+ xstyle={styles.card}
+ className={css.card}>
<VStack gap={3} xstyle={styles.inner}>
- {post.coverImage ? (
- <img
- src={post.coverImage}
- alt={post.coverAlt ?? ''}
- {...stylex.props(styles.cover(feature), styles.coverImg)}
- />
- ) : (
- <div {...stylex.props(styles.cover(feature))} aria-hidden="true" />
- )}
- <VStack gap={2}>
- <HStack gap={1} align="center" xstyle={styles.tagRow}>
- <Badge label={POST_TYPE_LABELS[post.type]} variant="neutral" />
- </HStack>
+ <AspectRatio ratio={16 / 9} xstyle={styles.cover} className={css.cover}>
+ {post.coverImage ? (
+ <img
+ src={post.coverImage}
+ alt={post.coverAlt ?? ''}
+ {...stylex.props(styles.coverImg)}
+ />
+ ) : (
+ <div aria-hidden="true" />
+ )}
+ </AspectRatio>
+ <VStack gap={3}>
<VStack gap={1}>
- <Heading level={feature ? 2 : 3}>{post.title}</Heading>
- <Text type="body" color="secondary" xstyle={styles.excerpt}>
+ <Heading level={feature ? 1 : 3}>{post.title}</Heading>
+ <Text
+ type="body"
+ color="secondary"
+ xstyle={styles.excerpt}
+ className={css.description}>
{post.description}
</Text>
</VStack>
<AuthorByline
- authors={post.authors}
date={post.date}
readingTimeMinutes={post.readingTimeMinutes}
variant="compact"
+ className={css.byline}
/>
- {post.tags.length > 0 ? (
- <HStack gap={1} xstyle={styles.tagRow}>
- {post.tags.map(tag => (
- <Badge key={tag} label={tag} variant="neutral" />
- ))}
- </HStack>
- ) : null}
+ <HStack gap={1} xstyle={styles.postTags}>
+ <Badge label={POST_TYPE_LABELS[post.type]} variant="cyan" />
+ {post.tags.map(tag => (
+ <Badge key={tag} label={tag} variant="neutral" />
+ ))}
+ </HStack>
</VStack>
</VStack>
- </ClickableCard>
+ </Link>
);
}
diff --git a/apps/docsite/src/components/blog/BlogIndex.tsx b/apps/docsite/src/components/blog/BlogIndex.tsx
index f35e4e220f..08b0e79588 100644
--- a/apps/docsite/src/components/blog/BlogIndex.tsx
+++ b/apps/docsite/src/components/blog/BlogIndex.tsx
@@ -2,17 +2,7 @@
/**
* @file BlogIndex.tsx
- *
- * Client component for the /blog index. Renders a grid of
- * post cards with horizontal post-type filters and no sidebar. The latest post
- * gets a larger "feature" treatment, derived purely from sort order.
- *
- * Filters only show types that actually have published content (issue #2896:
- * "Only show filters/tags publicly when content exists for them").
- *
- * @input posts (BlogPost[], already sorted latest-first), available types
- * @output The interactive blog index UI
- * @position Rendered by app/blog/page.tsx
+ * Blog index: post-type filters + a card grid, latest post featured.
*/
'use client';
@@ -23,28 +13,21 @@ import {Text, Heading} from '@astryxdesign/core/Text';
import {VStack} from '@astryxdesign/core/Layout';
import {Section} from '@astryxdesign/core/Section';
import {Grid} from '@astryxdesign/core/Grid';
-import {Carousel} from '@astryxdesign/core/Carousel';
-import {TabList, Tab} from '@astryxdesign/core/TabList';
+import {ToggleButton, ToggleButtonGroup} from '@astryxdesign/core/ToggleButton';
+import {EmptyState} from '@astryxdesign/core/EmptyState';
import type {BlogPost, BlogPostType} from '../../lib/blog/schema';
import {POST_TYPE_LABELS} from '../../lib/blog/schema';
import {BlogCard} from './BlogCard';
const styles = stylex.create({
- header: {
- maxWidth: 720,
- },
- filterRow: {
- marginBottom: 4,
- },
- empty: {
- paddingBlock: 48,
- textAlign: 'center',
+ typeFilter: {
+ flexWrap: 'wrap',
+ justifyContent: 'center',
},
});
export interface BlogIndexProps {
posts: BlogPost[];
- /** Post types that have at least one published post, in canonical order. */
availableTypes: BlogPostType[];
}
@@ -66,61 +49,55 @@ export function BlogIndex({posts, availableTypes}: BlogIndexProps) {
return map;
}, [posts, availableTypes]);
- // Feature the latest post only in the unfiltered "all" view.
const showFeature = activeType === 'all' && filtered.length > 0;
const featurePost = showFeature ? filtered[0] : null;
const restPosts = showFeature ? filtered.slice(1) : filtered;
return (
- <Section maxWidth={1100} padding={6}>
- <VStack gap={6}>
- <VStack gap={4} xstyle={styles.header}>
- <Heading level={1} type="display-1">
+ <Section maxWidth={800} padding={6} style={{marginInline: 'auto'}}>
+ <VStack gap={10}>
+ <VStack gap={2}>
+ <Heading level={1} type="display-1" justify="center">
Blog
</Heading>
- <Text type="large" weight="normal" color="secondary">
- Notes on building Astryx — releases, guides, stories, and
- perspectives on designing a system for humans and agents.
+ <Text weight="normal" color="secondary" justify="center">
+ Releases, guides, and stories on building Astryx for humans and
+ agents.
</Text>
</VStack>
{availableTypes.length > 1 ? (
- <Carousel gap={0}>
- <TabList
- value={activeType}
- onChange={v => setActiveType(v as 'all' | BlogPostType)}
- size="md"
- xstyle={styles.filterRow}>
- <Tab value="all" label={`All (${counts.all})`} />
- {availableTypes.map(t => (
- <Tab
- key={t}
- value={t}
- label={`${POST_TYPE_LABELS[t]} (${counts[t]})`}
- />
- ))}
- </TabList>
- </Carousel>
+ <ToggleButtonGroup
+ label="Filter posts by type"
+ value={activeType}
+ onChange={value =>
+ setActiveType((value as 'all' | BlogPostType) ?? 'all')
+ }
+ xstyle={styles.typeFilter}>
+ <ToggleButton value="all" label={`All (${counts.all})`} />
+ {availableTypes.map(t => (
+ <ToggleButton
+ key={t}
+ value={t}
+ label={`${POST_TYPE_LABELS[t]} (${counts[t]})`}
+ />
+ ))}
+ </ToggleButtonGroup>
) : null}
{filtered.length === 0 ? (
- <div {...stylex.props(styles.empty)}>
- <Text type="body" color="secondary">
- No posts yet. Check back soon.
- </Text>
- </div>
+ <EmptyState
+ title="No posts yet"
+ description="Check back soon for releases, guides, and stories."
+ />
) : (
- <VStack gap={6}>
- {featurePost ? (
- <Grid columns={1} gap={4}>
- <BlogCard post={featurePost} feature />
- </Grid>
- ) : null}
+ <VStack gap={10}>
+ {featurePost ? <BlogCard post={featurePost} feature /> : null}
{restPosts.length > 0 ? (
<Grid
columns={{minWidth: 320, repeat: 'fill'}}
- gap={4}
- rowGap={6}>
+ gap={5}
+ rowGap={10}>
{restPosts.map(post => (
<BlogCard key={post.slug} post={post} />
))}