From 33fe6df32026f374acab4d05e7f83bdc04cec0f2 Mon Sep 17 00:00:00 2001 From: r-freeman Date: Sat, 4 Feb 2023 23:12:00 +0000 Subject: [PATCH] Changed article layout on home/writing pages --- components/Card.tsx | 4 +--- pages/index.tsx | 29 +++++++++++++++-------------- pages/writing/index.tsx | 28 +++++++++++++++------------- 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/components/Card.tsx b/components/Card.tsx index 64843a1..fe59d95 100644 --- a/components/Card.tsx +++ b/components/Card.tsx @@ -6,7 +6,6 @@ import {Props} from 'types' type Card = { as?: ElementType className?: string - small?: boolean children: ReactNode } @@ -54,12 +53,11 @@ function ChevronRightIcon(props: Props) { export function Card({ as: Component = 'div', className, - small, children }: Card) { return ( {children} diff --git a/pages/index.tsx b/pages/index.tsx index 4a44e9f..0579195 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -1,3 +1,4 @@ +import React from 'react' import Head from 'next/head' import {GetStaticProps} from 'next' import {Card} from '@/components/Card' @@ -18,19 +19,19 @@ import {Article} from 'types' function Article(article: Article) { return ( - - - {article.title} - -

- - {formatDate(article.date)} - - -

- {article.description} - Read more -
+
+ + + {article.title} + +

+ + {formatDate(article.date)} + + +

+
+
) } @@ -147,7 +148,7 @@ export const getStaticProps: GetStaticProps = async () => { return { props: { articles: (await getAllArticles()) - .slice(0, 1) + .slice(0, 3) .map(({component, ...meta}) => meta), } } diff --git a/pages/writing/index.tsx b/pages/writing/index.tsx index a63e100..ffaeeb0 100644 --- a/pages/writing/index.tsx +++ b/pages/writing/index.tsx @@ -1,28 +1,27 @@ +import React from 'react' import {GetStaticProps} from 'next' import Head from 'next/head' - import {Card} from '@/components/Card' import {SimpleLayout} from '@/components/layouts/SimpleLayout' +import {Views} from '@/components/Views' +import {Subscribe} from '@/components/Subscribe' import {getAllArticles} from '@/lib/getAllArticles' import {formatDate} from '@/lib/formatDate' - import {Article} from 'types' function Article({article}: { article: Article }) { return (
- + {article.title} - - {formatDate(article.date)} - +

+ + {formatDate(article.date)} + + +

) @@ -51,12 +50,15 @@ export default function ArticlesIndex({articles}: { articles: Article[] }) { intro="All of my long-form thoughts on software engineering, and more, displayed in chronological order." gradient="bg-gradient-to-r from-pink-500 to-violet-500" > -
-
+
+
{articles.map((article) => (
))}
+
+ +