added projects
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
rei
2022-12-29 13:42:04 +01:00
parent 446c4a4241
commit e545a596ec
9 changed files with 474 additions and 32 deletions

View File

@@ -1,8 +1,9 @@
import { GetServerSideProps } from "next";
import { MainLayout } from "../../layouts/MainLayout";
import { BlogPost, getAllFilesFrontMatter } from "../../utils/markdown";
import { Post, getAllBlogsFrontMatter } from "../../utils/markdown";
import { FrontMatter } from "../../types/types";
import Link from "next/link";
import { formatDate } from "../../utils/general";
export interface BasicBlogProps extends FrontMatter {
title: string;
@@ -13,19 +14,10 @@ export interface BasicBlogProps extends FrontMatter {
}
const BlogCard = ({ blog, slug }: { blog: BasicBlogProps; slug: string }) => {
const format = (date: string) => {
const [day, month, year] = date.split(".");
const d = new Date(`${year}-${month}-${day}`);
return d.toLocaleDateString("en-US", {
month: "long",
day: "numeric",
year: "numeric",
});
};
return (
<div className="p-4 rounded-md border border-gray-700">
<div className="text-sm font-medium text-gray-500">
{format(blog.date)}
{formatDate(blog.date)}
</div>
<h2 className="text-2xl font-bold">{blog.title}</h2>
<p className="text-gray-400 text-lg">{blog.description}</p>
@@ -38,7 +30,7 @@ const BlogCard = ({ blog, slug }: { blog: BasicBlogProps; slug: string }) => {
);
};
const Blog = ({ posts }: { posts: BlogPost[] }) => {
const Blog = ({ posts }: { posts: Post[] }) => {
return (
<MainLayout>
<h1 className="text-3xl font-bold">Blog</h1>
@@ -57,7 +49,7 @@ const Blog = ({ posts }: { posts: BlogPost[] }) => {
};
export const getServerSideProps: GetServerSideProps = async () => {
const posts = getAllFilesFrontMatter();
const posts = getAllBlogsFrontMatter();
return {
props: {
posts,