reinit the project

Signed-off-by: nurRiyad <asadnurriyad@gmail.com>
This commit is contained in:
nurRiyad
2023-01-05 22:16:03 +06:00
parent bb2c026901
commit e8b02f2414
38 changed files with 506 additions and 3417 deletions

View File

@@ -1,68 +0,0 @@
<script setup lang="ts">
import type { ParsedContent } from "@nuxt/content/dist/runtime/types";
const data = useState("blogData");
// get all the unique types from content
const getTopCategory = computed(() => {
const allpost = (data.value as Array<ParsedContent>) || [];
const alltypes = allpost.map((post) => {
return {
type: post.type,
dir: post._dir,
};
});
return [...new Map(alltypes.map((item) => [item["dir"], item])).values()];
});
// get all post in recent time order
const getRecentContent = computed(() => {
const allpost = (data.value as Array<ParsedContent>) || [];
const customizePost = allpost.map((post) => {
return {
title: post.title,
description: post.description,
path: post._path,
date: post.date as string,
type: post.type,
};
});
customizePost.sort(function (a, b) {
const c = new Date(a.date);
const d = new Date(b.date);
return c < d ? 1 : -1;
});
return customizePost.filter((post, idx) => idx < 6);
});
</script>
<template>
<div
class="container px-4 mx-auto max-w-6xl flex font-ibmmono gap-14 antialiased min-h-screen"
>
<div class="flex-1">
<h1 class="text-xl pb-8 text-[#e60067]">RECENTLY PUBLISHED</h1>
<div class="space-y-8">
<template v-for="rp in getRecentContent" :key="rp">
<blog-card
:title="rp.title"
:description="rp.description"
:path="rp.path"
:date="rp.date"
:type="rp.type"
/>
</template>
</div>
</div>
<div class="basis-1/4">
<div>
<h2 class="text-xl pb-8 text-[#e60067]">TOP CATEGORIES</h2>
<template v-for="cat in getTopCategory" :key="cat">
<topic-card :title="cat.type" :dir="cat.dir" />
</template>
</div>
</div>
</div>
</template>