From 820c96158648075e1e033ee904c07216c2598ae4 Mon Sep 17 00:00:00 2001 From: DefectingCat Date: Thu, 25 Aug 2022 10:17:09 +0800 Subject: [PATCH] Update pagination styling fix padding issue --- components/mdx/Anchor.tsx | 52 +++++++++++++++++++++------------------ pages/blog/[page].tsx | 2 +- pages/blog/index.tsx | 6 +---- pages/gists/[p].tsx | 3 ++- pages/gists/index.tsx | 3 ++- 5 files changed, 34 insertions(+), 32 deletions(-) diff --git a/components/mdx/Anchor.tsx b/components/mdx/Anchor.tsx index 3acaba5..020a3f4 100644 --- a/components/mdx/Anchor.tsx +++ b/components/mdx/Anchor.tsx @@ -1,4 +1,4 @@ -import { AnchorHTMLAttributes } from 'react'; +import { AnchorHTMLAttributes, forwardRef } from 'react'; import cn from 'classnames'; import { FiExternalLink } from 'react-icons/fi'; @@ -6,29 +6,33 @@ interface Props extends AnchorHTMLAttributes { external?: boolean; } -const Anchor = ({ children, external = true, ...rest }: Props) => { - return ( - <> - - ( + ({ children, external = true, ...rest }, ref) => { + return ( + <> + - {children} - {external && } - - - - ); -}; + + {children} + {external && } + + + + ); + } +); +Anchor.displayName = 'Anchor'; export default Anchor; diff --git a/pages/blog/[page].tsx b/pages/blog/[page].tsx index f6e4187..c81aa4f 100644 --- a/pages/blog/[page].tsx +++ b/pages/blog/[page].tsx @@ -28,7 +28,7 @@ const BlogPage = ({ import('components/RUA/RUAPagination')); const Blog = ({ posts, - prev, next, total, }: InferGetStaticPropsType) => { @@ -29,7 +27,7 @@ const Blog = ({ = async () => { @@ -53,7 +50,6 @@ export const getStaticProps: GetStaticProps<{ props: { // Latest posts. posts: posts.slice(0, PostPerPage), - prev: 0, next: 2, total: Math.ceil(posts.length / PostPerPage), }, diff --git a/pages/gists/[p].tsx b/pages/gists/[p].tsx index 9dea1e1..f7e6d21 100644 --- a/pages/gists/[p].tsx +++ b/pages/gists/[p].tsx @@ -26,9 +26,10 @@ const Gists = ({
-
+
-
+