From 69c61eb942ef09c0e428396e73de7599acb7a9ba Mon Sep 17 00:00:00 2001 From: ThyeeZz Date: Mon, 9 Sep 2024 17:26:55 +0800 Subject: [PATCH 1/3] add pagination to milvus blog --- .../card/{BlogCard.jsx => BlogCard.tsx} | 12 +- .../cookieConsent/index.module.less | 2 +- src/components/ui/pagination.tsx | 147 ++++++++ src/pages/blog/index.jsx | 211 ----------- src/pages/blog/index.tsx | 335 ++++++++++++++++++ src/parts/home/lovedSection/index.module.less | 2 +- src/styles/blog.module.less | 99 ++---- src/styles/mixin.module.less | 29 +- src/utils/blog.utils.ts | 3 +- 9 files changed, 559 insertions(+), 281 deletions(-) rename src/components/card/{BlogCard.jsx => BlogCard.tsx} (74%) create mode 100644 src/components/ui/pagination.tsx delete mode 100644 src/pages/blog/index.jsx create mode 100644 src/pages/blog/index.tsx diff --git a/src/components/card/BlogCard.jsx b/src/components/card/BlogCard.tsx similarity index 74% rename from src/components/card/BlogCard.jsx rename to src/components/card/BlogCard.tsx index 5b681eb97..71a3f8e57 100644 --- a/src/components/card/BlogCard.jsx +++ b/src/components/card/BlogCard.tsx @@ -1,10 +1,18 @@ import React from 'react'; import Link from 'next/link'; -import * as styles from './BlogCard.module.less'; +import styles from './BlogCard.module.less'; import Tags from '../tags'; import clsx from 'clsx'; -const BlogCard = ({ title, desc, tags, cover, locale, path, className }) => { +const BlogCard = (props: { + title: string; + desc: string; + tags: string[]; + cover: string; + path: string; + className?: string; +}) => { + const { title, desc, tags, cover, path, className } = props; const to = `/blog/${path}`; return ( diff --git a/src/components/cookieConsent/index.module.less b/src/components/cookieConsent/index.module.less index 4da4858a2..5d9570b93 100644 --- a/src/components/cookieConsent/index.module.less +++ b/src/components/cookieConsent/index.module.less @@ -31,7 +31,7 @@ } p { - .paragraph5-regular(); + .paragraph6-regular(); color: @color-black2; font-family: Inter !important; } diff --git a/src/components/ui/pagination.tsx b/src/components/ui/pagination.tsx new file mode 100644 index 000000000..48d19d717 --- /dev/null +++ b/src/components/ui/pagination.tsx @@ -0,0 +1,147 @@ +import * as React from 'react'; +import { ChevronLeft, ChevronRight, MoreHorizontal } from 'lucide-react'; + +import { cn } from '@/utils/merge'; +import { ButtonProps, buttonVariants } from '@/components/ui/button'; +import Link from 'next/link'; + +const Pagination = ({ className, ...props }: React.ComponentProps<'nav'>) => ( +