-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #144 from nyomansunima/137-chore-add-the-blog-post…
…-series 137 chore add the blog post series
- Loading branch information
Showing
9 changed files
with
251 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { Calendar } from 'react-iconly' | ||
import { defineField, defineType } from 'sanity' | ||
|
||
export default defineType({ | ||
title: 'Blog Series', | ||
name: 'series', | ||
type: 'document', | ||
icon: Calendar, | ||
fields: [ | ||
defineField({ | ||
title: 'Image', | ||
name: 'thumbnail', | ||
type: 'image', | ||
}), | ||
defineField({ | ||
title: 'SLUG', | ||
name: 'slug', | ||
type: 'slug', | ||
options: { | ||
source: 'title', | ||
}, | ||
}), | ||
defineField({ | ||
title: 'Title', | ||
name: 'title', | ||
type: 'string', | ||
}), | ||
defineField({ | ||
title: 'Description', | ||
name: 'desc', | ||
type: 'text', | ||
}), | ||
], | ||
preview: { | ||
select: { | ||
media: 'thumbnail', | ||
title: 'title', | ||
subtitle: 'slug.current', | ||
}, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<template> | ||
<NuxtLink | ||
:href="`/blog/${data.slug}`" | ||
class="flex flex-col laptop:flex-row gap-5 transition-all duration-700 hover:scale-95 group" | ||
> | ||
<div | ||
class="flex justify-center items-center overflow-hidden h-64 laptop:h-44 laptop:w-44 rounded-3xl relative" | ||
> | ||
<NuxtImg | ||
:src="data.thumbnail" | ||
:alt="data.title" | ||
class="flex h-full w-full object-cover transition-all duration-500 hover:scale-105" | ||
/> | ||
<span | ||
class="absolute bg-white dark:bg-black transition-all rounded-full h-12 w-12 flex justify-center items-center text-xl top-2 left-2" | ||
>{{ position }}</span | ||
> | ||
</div> | ||
<div class="flex flex-col flex-1 py-2"> | ||
<h3 class="text-2xl !leading-tight line-clamp-2">{{ data.title }}</h3> | ||
<div class="flex flex-wrap mt-5"> | ||
<span | ||
class="flex justify-center items-center px-5 py-3 rounded-full border border-neutral-100 dark:border-neutral-800 gap-3" | ||
> | ||
<p class="h-2 w-2 rounded-full bg-black dark:bg-white"></p> | ||
{{ data.tag }}</span | ||
> | ||
</div> | ||
</div> | ||
</NuxtLink> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { BlogPost } from '~/types/content' | ||
interface BlogSeriesItemProps { | ||
position: number | ||
data: BlogPost | ||
} | ||
defineProps<BlogSeriesItemProps>() | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<template> | ||
<NuxtLink :href="`/blog/series/${data.slug}`" class="flex flex-col"> | ||
<div | ||
class="flex h-64 w-full justify-center items-center overflow-hidden rounded-2xl" | ||
> | ||
<NuxtImg | ||
:src="data.thumbnail" | ||
:alt="data.title" | ||
class="flex h-full w-full object-cover transition-all duration-700 hover:scale-105" | ||
/> | ||
</div> | ||
<h3 class="text-2xl mt-7 line-clamp-2">{{ data.title }}</h3> | ||
</NuxtLink> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { BlogSeries } from '~/types/content' | ||
interface SeriesItemProps { | ||
data: BlogSeries | ||
} | ||
defineProps<SeriesItemProps>() | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<template> | ||
<main class="flex flex-col py-40"> | ||
<section | ||
class="flex flex-col laptop:flex-row container mx-auto px-5 laptop:px-20 gap-10" | ||
> | ||
<div | ||
class="flex flex-col laptop:w-1/2 h-[250px] laptop:h-[600px] overflow-hidden rounded-3xl" | ||
> | ||
<NuxtImg | ||
:src="detail.thumbnail" | ||
:alt="detail.title" | ||
class="h-full w-full object-cover transition-all duration-700 hover:scale-105" | ||
/> | ||
</div> | ||
<div class="flex flex-col laptop:w-1/2 laptop:pt-10"> | ||
<div class="flex"> | ||
<TextButton | ||
@click="navigateTo('/blog')" | ||
class="transition-all duration-500 hover:-translate-x-1" | ||
><i | ||
class="fi fi-rr-arrow-left text-2xl h-12 w-12 rounded-full bg-black text-white dark:bg-white dark:text-black" | ||
></i> | ||
Back to blog</TextButton | ||
> | ||
</div> | ||
<h2 class="text-4xl laptop:text-5xl !leading-tight mt-10"> | ||
{{ detail.title }} | ||
</h2> | ||
<div class="flex flex-wrap mt-5"> | ||
<span | ||
class="border border-neutral-100 dark:border-neutral-800 px-5 py-3 rounded-full relative" | ||
> | ||
<span | ||
class="h-2 w-2 rounded-full bg-red-500 absolute top-1 right-1" | ||
></span> | ||
{{ detail.totalContent > 0 ? detail.totalContent : 'No' }} | ||
Articles</span | ||
> | ||
</div> | ||
<p class="text-xl leading-relaxed mt-10">{{ detail.desc }}</p> | ||
</div> | ||
</section> | ||
|
||
<section | ||
class="flex container mx-auto px-5 laptop:px-20 mt-20 laptop:mt-40" | ||
> | ||
<div class="grid grid-cols-1 laptop:grid-cols-2 w-full gap-10"> | ||
<BlogSeriesItem | ||
v-for="(post, i) in contents" | ||
:data="post" | ||
:position="i + 1" | ||
/> | ||
</div> | ||
</section> | ||
</main> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { BlogSeriesDetail } from '~/types/content' | ||
import { loadSeriesDetail } from '~/lib/queries' | ||
definePageMeta({ | ||
layout: 'blog', | ||
}) | ||
const route = useRoute() | ||
const { | ||
data: { | ||
value: { detail, contents }, | ||
}, | ||
} = await useSanityQuery<BlogSeriesDetail>(loadSeriesDetail, { | ||
slug: route.params.slug, | ||
}) | ||
useSeoMeta({ | ||
title: detail.title, | ||
description: detail.desc.substring(0, 40), | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76e1d41
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
personal-site-studio – ./apps/studio
personal-site-studio-git-main-nyomansunima.vercel.app
personal-site-studio-nyomansunima.vercel.app
studio.nyomansunima.vercel.app
studio.nyomansunima.com
76e1d41
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
personal-site – ./apps/web
personal-site-git-main-nyomansunima.vercel.app
nyomansunima.com
personal-site-nyomansunima.vercel.app
nyomansunima.vercel.app