chore: move blog types to index

This commit is contained in:
javayhu 2025-06-20 21:09:50 +08:00
parent 107f761716
commit b17599976f
5 changed files with 15 additions and 28 deletions

View File

@ -1,5 +1,5 @@
import Container from '@/components/layout/container';
import type { BlogCategory } from '@/types/blog-types';
import type { BlogCategory } from '@/types';
import { BlogCategoryListDesktop } from './blog-category-list-desktop';
import { BlogCategoryListMobile } from './blog-category-list-mobile';

View File

@ -3,7 +3,7 @@
import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group';
import { LocaleLink } from '@/i18n/navigation';
import { cn } from '@/lib/utils';
import type { BlogCategory } from '@/types/blog-types';
import type { BlogCategory } from '@/types';
import { useTranslations } from 'next-intl';
import { useParams } from 'next/navigation';

View File

@ -9,7 +9,7 @@ import {
DrawerTitle,
DrawerTrigger,
} from '@/components/ui/drawer';
import type { BlogCategory } from '@/types/blog-types';
import type { BlogCategory } from '@/types';
import { LayoutListIcon } from 'lucide-react';
import { useTranslations } from 'next-intl';
import { useParams } from 'next/navigation';

View File

@ -1,25 +0,0 @@
/**
* Blog Category
*
* we can not pass CategoryType from server component to client component
* so we need to define a new type, and use it in the client component
*/
export type BlogCategory = {
slug: string;
name: string;
description: string;
};
export type BlogAuthor = {
slug: string;
name: string;
description: string;
avatar: string;
};
export type BlogPost = {
slug: string;
title: string;
description: string;
date: string;
};

12
src/types/index.d.ts vendored
View File

@ -163,3 +163,15 @@ export type MenuItem = {
export type NestedMenuItem = MenuItem & {
items?: MenuItem[]; // The items to display in the nested menu
};
/**
* Blog Category
*
* we can not pass CategoryType from server component to client component
* so we need to define a new type, and use it in the client component
*/
export type BlogCategory = {
slug: string;
name: string;
description: string;
};