-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a page to view all articles (#2)
* add spaces before year * add footnote and citation block * add build check for pull requests * Add articles page
- Loading branch information
Showing
7 changed files
with
169 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
// app/articles/page.tsx | ||
import Link from 'next/link'; | ||
import Image from 'next/image'; | ||
import { getAllArticles } from '@/lib/articles'; | ||
|
||
import Header from '@/components/header'; | ||
import Footer from '@/components/footer'; | ||
|
||
type ArticleType = 'PEER-REVIEWED' | 'EDITORIAL'; | ||
|
||
const badgeStyles: Record<ArticleType, string> = { | ||
'PEER-REVIEWED': "bg-gray-700 text-white", | ||
'EDITORIAL': "bg-white border border-gray-300 text-gray-700" | ||
}; | ||
|
||
function ArticleBadge({ type }: { type: ArticleType }) { | ||
const baseClasses = "px-2 py-1 text-xs font-medium tracking-wide uppercase"; | ||
const styleClass = badgeStyles[type]; | ||
|
||
return ( | ||
<span className={`${baseClasses} ${styleClass}`}> | ||
{type} | ||
</span> | ||
); | ||
} | ||
|
||
export default async function ArticlesPage() { | ||
const articles = await getAllArticles(); | ||
|
||
return ( | ||
<div className="min-h-screen bg-white"> | ||
<Header /> | ||
|
||
<main className="max-w-screen-xl mx-auto px-4 sm:px-6 py-8"> | ||
<div className="space-y-16"> | ||
{articles.map(article => { | ||
if (!article) return null; | ||
const { frontMatter, slug } = article; | ||
const date = new Date(frontMatter.publishedDate); | ||
|
||
return ( | ||
<article key={slug} className="relative group"> | ||
<div className="grid grid-cols-1 md:grid-cols-[120px_1fr_300px] gap-8"> | ||
{/* Left column: Date and badges */} | ||
<div className="flex flex-row md:flex-col gap-4 md:gap-2"> | ||
<time | ||
dateTime={frontMatter.publishedDate} | ||
className="text-sm text-gray-500 whitespace-nowrap" | ||
> | ||
{date.toLocaleDateString('en-US', { | ||
month: 'long', | ||
day: 'numeric', | ||
year: 'numeric' | ||
})} | ||
</time> | ||
<div className="flex gap-2"> | ||
{frontMatter.type && ( | ||
<ArticleBadge type={frontMatter.type as ArticleType} /> | ||
)} | ||
</div> | ||
</div> | ||
|
||
{/* Middle column: Article content */} | ||
<div className="flex-1"> | ||
<Link | ||
href={`/articles/${slug}`} | ||
className="group-hover:text-blue-600 transition-colors" | ||
> | ||
<h2 className="text-2xl font-semibold text-gray-900 mb-2"> | ||
{frontMatter.title} | ||
</h2> | ||
</Link> | ||
|
||
<div className="text-gray-700 mb-3"> | ||
{frontMatter.authors?.map(author => author.name).join(', ')} | ||
</div> | ||
|
||
{frontMatter.description && ( | ||
<p className="text-gray-600 leading-relaxed"> | ||
{frontMatter.description} | ||
</p> | ||
)} | ||
</div> | ||
|
||
{/* Right column: Figure */} | ||
{frontMatter.image && ( | ||
<div className="relative w-full aspect-[4/3] rounded-lg overflow-hidden"> | ||
<Image | ||
src={frontMatter.image.url} | ||
alt={frontMatter.image.alt || ''} | ||
fill | ||
className="object-contain" | ||
/> | ||
</div> | ||
)} | ||
</div> | ||
|
||
{/* Bottom border */} | ||
<div className="absolute -bottom-8 left-0 right-0 h-px bg-gray-200" /> | ||
</article> | ||
); | ||
})} | ||
</div> | ||
</main> | ||
<Footer /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
title: Usher AI Agents into Human Social World | ||
description: 2025 Editorial | ||
publishedDate: 2025-01-10 | ||
authors: | ||
- name: Hao Zhu | ||
personalURL: https://zhuhao.me | ||
affiliation: Stanford University | ||
affiliationURL: https://www.stanford.edu | ||
- name: Diyi Yang | ||
personalURL: https://cs.stanford.edu/~diyiy/ | ||
affiliation: Stanford University | ||
affiliationURL: https://www.stanford.edu | ||
doi: 10.1234/example.2023.001 | ||
type: EDITORIAL | ||
--- | ||
|
||
|
||
## Introduction | ||
|
||
|
||
|
||
## Methods | ||
|
||
Here's an example code block: | ||
|
||
<Code language="python"> | ||
{`def analyze_complex_system(data: np.ndarray) -> np.ndarray: | ||
# Analysis code here | ||
return processed_data`} | ||
</Code> | ||
|
||
## Results | ||
|
||
Our findings indicate significant patterns in the data. | ||
|
||
<Bibliography /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters