make page functional

Signed-off-by: nurRiyad <asadnurriyad@gmail.com>
This commit is contained in:
nurRiyad
2023-01-10 00:30:21 +06:00
parent cdab5c90ea
commit 1f23eaaa22
9 changed files with 39 additions and 23 deletions

View File

@@ -1,39 +1,48 @@
<script lang="ts" setup> <script lang="ts" setup>
defineProps<{ interface Props {
title: string title: string
excerpt?: string description: string
image?: string time: string
slug?: string link: string
}>() tags: Array<string>
}
withDefaults(defineProps<Props>(), {
title: 'No title availabe',
description: 'No description available',
time: 'No time available',
link: '/',
tags: () => ['no-tag'],
})
</script> </script>
<template> <template>
<article class="group border p-5 m-2 rounded-2xl shadow-lg text-zinc-700"> <article class="group border p-5 m-2 rounded-2xl shadow-lg text-zinc-700">
<NuxtLink :to="slug" class="grid grid-cols-1 sm:grid-cols-9 gap-5"> <NuxtLink :to="link" class="grid grid-cols-1 sm:grid-cols-9 gap-5">
<div class="sm:col-span-2"> <div class="sm:col-span-2">
<img <img
class="lg:h-48 md:h-36 sm:h-36 w-full object-cover object-center rounded-2xl shadow-lg group-hover:scale-[1.05] transition-all duration-500" class="lg:h-48 md:h-36 sm:h-36 w-full object-cover object-center rounded-2xl shadow-lg group-hover:scale-[1.05] transition-all duration-500"
src="/blogs/hello-world/riyad.jpg" :src="`${link}/cover.jpg`"
alt="card photo" :alt="title"
/> />
</div> </div>
<div class="sm:col-span-7"> <div class="sm:col-span-7">
<h2 class="text-3xl font-semibold text-black pb-1 group-hover:text-sky-600"> <h2 class="text-3xl font-semibold text-black pb-1 group-hover:text-sky-600">
This is the card title {{ title }}
</h2> </h2>
<p class="text-ellipsis line-clamp-2"> <p class="text-ellipsis line-clamp-2">
{{ excerpt }} {{ description }}
</p> </p>
<div class="text-black text-sm pt-4 pb-2"> <div class="text-black text-sm pt-4 pb-2">
<div class="flex items-center"> <div class="flex items-center">
<LogoDate /> <LogoDate />
3rd July 2022 {{ time }}
</div> </div>
<div class="flex items-center gap-1 flex-wrap"> <div class="flex items-center gap-1 flex-wrap">
<LogoTag /> <LogoTag />
<span>JavaScript</span> <template v-for="tag in tags" :key="tag">
<span>Typescript</span> <span>{{ tag }}</span>
<span>Clean</span> </template>
</div> </div>
</div> </div>
<div class="flex group-hover:underline text-sky-600 items-center pt-2"> <div class="flex group-hover:underline text-sky-600 items-center pt-2">

View File

@@ -21,7 +21,7 @@ withDefaults(defineProps<Props>(), {
<NuxtLink :to="link"> <NuxtLink :to="link">
<img <img
class="lg:h-48 md:h-36 w-full object-cover object-center rounded-2xl shadow-lg group-hover:scale-[1.05] transition-all duration-500" class="lg:h-48 md:h-36 w-full object-cover object-center rounded-2xl shadow-lg group-hover:scale-[1.05] transition-all duration-500"
src="/blogs/hello-world/riyad.jpg" :src="`${link}/cover.jpg`"
:alt="title" :alt="title"
/> />
<div class="text-black text-sm pt-4 pb-2"> <div class="text-black text-sm pt-4 pb-2">

View File

@@ -9,18 +9,19 @@ useHead({
], ],
titleTemplate: "Elon's Blog - %s", titleTemplate: "Elon's Blog - %s",
}) })
const { data } = await useAsyncData('home', () => queryContent('/blogs').find()) const { data } = await useAsyncData('home', () => queryContent('/blogs').sort({ _id: -1 }).find())
</script> </script>
<template> <template>
<main class="container max-w-5xl mx-auto text-zinc-600"> <main class="container max-w-5xl mx-auto text-zinc-600">
<ArchiveHero /> <ArchiveHero />
<div> <div>
<template v-for="n in data" :key="n"> <template v-for="post in data" :key="n">
<ArchiveCard <ArchiveCard
:title="n.title || ''" :title="post.title"
:excerpt="n.description" :description="post.description"
image="sdlfkj" :link="post._path"
:slug="n._path" :time="post.time"
:tags="post.tags"
/> />
</template> </template>
</div> </div>

View File

@@ -32,8 +32,14 @@ const { data } = await useAsyncData('home', () =>
<main class="container max-w-5xl mx-auto text-zinc-600"> <main class="container max-w-5xl mx-auto text-zinc-600">
<CategoryTopic /> <CategoryTopic />
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3"> <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3">
<template v-for="n in data" :key="n"> <template v-for="post in data" :key="n">
<BlogCard :title="n.title || ''" :excerpt="n.description" image="sdlfkj" :slug="n._path" /> <BlogCard
:title="post.title"
:description="post.description"
:link="post._path"
:time="post.time"
:tags="post.tags"
/>
</template> </template>
<template v-if="data?.length === 0"> <template v-if="data?.length === 0">
<BlogEmpty /> <BlogEmpty />

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB