refactor: improve news and email handling, style, folder structure (#16)

This commit is contained in:
Riccardo Senica
2024-06-04 18:04:54 +08:00
committed by GitHub
parent bc5e0cc195
commit acc10bf5fd
62 changed files with 1737 additions and 1553 deletions

56
components/CustomCard.tsx Normal file
View File

@@ -0,0 +1,56 @@
import { ReactNode, useEffect, useState } from 'react';
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle
} from './Card';
import Footer from './Footer';
interface CardProps {
title: string;
description?: string;
content: ReactNode;
className?: string;
footer?: boolean;
}
export default function CustomCard({
title,
description,
content,
className,
footer = true
}: CardProps) {
const [isLoaded, setIsLoaded] = useState(false);
useEffect(() => {
setIsLoaded(true);
}, []);
if (!isLoaded) {
return null;
}
return (
<div className='gradient-border shadow-2xl shadow-black'>
<Card className={`z-10 max-w-[90vw] p-8 ${className}`}>
<CardHeader>
<p className='text-xs uppercase text-gray-500'>
Hackernews + newsletter
</p>
<CardTitle>{title}</CardTitle>
<CardDescription>{description}</CardDescription>
</CardHeader>
<CardContent>{content}</CardContent>
{footer && (
<CardFooter>
<Footer />
</CardFooter>
)}
</Card>
</div>
);
}