Refactor README and improve component imports

This commit is contained in:
KazooTTT
2025-01-04 12:41:16 +08:00
parent 9b71eb792d
commit 310ff3aa7f
9 changed files with 24 additions and 96 deletions

View File

@ -1,7 +1,7 @@
---
import { Image } from 'astro:assets'
import type { ImageMetadata } from 'astro'
import { cn } from '@/utils'
import type { ImageMetadata } from 'astro'
import { Image } from 'astro:assets'
const {
as: Tag = 'div',
@ -49,8 +49,8 @@ if (imagePath) {
<div class='flex flex-col gap-y-1.5'>
<div class='flex flex-col gap-y-0.5'>
<h1 class='text-lg font-medium'>{heading}</h1>
<h2 class='text-muted-foreground'>{subheading}</h2>
<h2 class='text-muted-foreground'>{date}</h2>
{subheading && <h2 class='text-muted-foreground'>{subheading}</h2>}
{date && <h2 class='text-muted-foreground'>{date}</h2>}
</div>
<slot />
</div>

View File

@ -1,8 +1,8 @@
---
import type { CollectionEntry } from 'astro:content'
import FormattedDate from '../FormattedDate.astro'
import Card from '../Card.astro'
import { Icon } from 'astro-icon/components'
import type { CollectionEntry } from 'astro:content'
import Card from '../Card.astro'
import FormattedDate from '../FormattedDate.astro'
import Label from '../Label.astro'
interface Props {

View File

@ -1,6 +1,6 @@
---
import PageLayout from '@/layouts/BaseLayout.astro'
import Button from '@/components/Button.astro'
import PageLayout from '@/layouts/BaseLayout.astro'
const meta = {
description: 'Not found',

View File

@ -4,10 +4,10 @@ export const prerender = true
import type { GetStaticPaths, Page } from 'astro'
import type { CollectionEntry } from 'astro:content'
import Button from '@/components/Button.astro'
import Pagination from '@/components/Paginator.astro'
import PostPreview from '@/components/blog/PostPreview.astro'
import PageLayout from '@/layouts/BaseLayout.astro'
import Button from '@/components/Button.astro'
import { getAllPosts, getUniqueCategories, sortMDByDate } from '@/utils'
export const getStaticPaths: GetStaticPaths = async ({ paginate }) => {
@ -56,7 +56,7 @@ const paginationProps = {
<PageLayout meta={meta}>
<div class='w-full'>
<Button title='Back' href='/blog' style='button'>
<Button title='Back' href='/categories' style='button'>
<svg
xmlns='http://www.w3.org/2000/svg'
width='14'

View File

@ -7,8 +7,8 @@ const allPosts = await getAllPosts()
const allCategories = getUniqueCategoriesWithCount(allPosts)
const meta = {
description: "A list of all the topics I've written about in my posts",
title: 'All Categories'
description: 'A list of all the topics I\'ve written about in my posts',
title: 'All Categories'
}
---

View File

@ -36,7 +36,7 @@ const friends = [
},
{
name: `Roi's Blog`,
url: 'https://roi.moe/',
url: 'https://roi.moe/'
}
]
---

View File

@ -18,9 +18,9 @@ Disallow: /500
`
export const GET: APIRoute = () => {
return new Response(robotsTxt.trim(), {
headers: {
'Content-Type': 'text/plain; charset=utf-8',
},
})
return new Response(robotsTxt.trim(), {
headers: {
'Content-Type': 'text/plain; charset=utf-8'
}
})
}

View File

@ -4,10 +4,10 @@ export const prerender = true
import type { GetStaticPaths, Page } from 'astro'
import type { CollectionEntry } from 'astro:content'
import Button from '@/components/Button.astro'
import Pagination from '@/components/Paginator.astro'
import PostPreview from '@/components/blog/PostPreview.astro'
import PageLayout from '@/layouts/BaseLayout.astro'
import Button from '@/components/Button.astro'
import { getAllPosts, getUniqueTags, sortMDByDate } from '@/utils'
export const getStaticPaths: GetStaticPaths = async ({ paginate }) => {
@ -54,7 +54,7 @@ const paginationProps = {
<PageLayout meta={meta}>
<div class='w-full'>
<Button title='Back' href='/blog' style='button'>
<Button title='Back' href='/tags' style='button'>
<svg
xmlns='http://www.w3.org/2000/svg'
width='14'