From 83702463d50c103e298ab51a2f5d1b7ce6a2c129 Mon Sep 17 00:00:00 2001 From: r-freeman Date: Tue, 7 Feb 2023 23:39:38 +0000 Subject: [PATCH] Changed article style on writing page --- components/Card.tsx | 25 ++++++++++++++++++++++++- pages/writing/index.tsx | 10 +++------- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/components/Card.tsx b/components/Card.tsx index fe59d95..78b88b4 100644 --- a/components/Card.tsx +++ b/components/Card.tsx @@ -1,10 +1,12 @@ import Link from 'next/link' import clsx from 'clsx' import {ElementType, ReactNode} from 'react' +import {twMerge} from 'tailwind-merge' import {Props} from 'types' type Card = { as?: ElementType + variant?: string className?: string children: ReactNode } @@ -52,12 +54,33 @@ function ChevronRightIcon(props: Props) { export function Card({ as: Component = 'div', + variant = 'normal', className, children }: Card) { + + type VariantStyles = { + normal: string + inline: string + } + + const variantStyles: VariantStyles = { + normal: + 'flex-col', + inline: + 'flex-col md:flex-row md:justify-between', + } + return ( {children} diff --git a/pages/writing/index.tsx b/pages/writing/index.tsx index ffaeeb0..658660a 100644 --- a/pages/writing/index.tsx +++ b/pages/writing/index.tsx @@ -4,7 +4,6 @@ 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' @@ -12,11 +11,11 @@ import {Article} from 'types' function Article({article}: { article: Article }) { return (
- + {article.title} -

+

{formatDate(article.date)} @@ -50,15 +49,12 @@ 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) => (
))}
-
- -