From 03e77566e066556241937ba1d72cc8160a3d4af3 Mon Sep 17 00:00:00 2001 From: buyfakett Date: Mon, 24 Feb 2025 13:36:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=A4=E6=96=AD=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E6=9D=A5=E8=BF=94=E5=9B=9E=E5=AE=BD=E5=BA=A6=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=82=B9=E5=87=BB=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/util/Comment.jsx | 20 +++++++++++++++++++- src/view/AboutMe/OpenSourceProjects.jsx | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/util/Comment.jsx b/src/util/Comment.jsx index 4be8888..8b053cd 100644 --- a/src/util/Comment.jsx +++ b/src/util/Comment.jsx @@ -1,9 +1,27 @@ import React from 'react'; import Giscus from '@giscus/react'; +import { useLocation } from 'react-router'; const Comment = () => { + const location = useLocation(); // 获取当前路径 + const currentPath = location.pathname; + let commentWidth; + + switch (currentPath) { + case '/pictures': + case '/coffee': + commentWidth = 'w-[80%]'; + break; + case '/projects': + commentWidth = 'w-[70%]'; + break; + default: + commentWidth = 'w-[60%]'; + break; + } + return ( -
+
{ navigate('/projects'); window.scrollTo(0, 0); }} - className="flex items-center gap-2 text-white ml-auto mr-10"> + className="flex items-center cursor-pointer gap-2 text-white ml-auto mr-10"> More Projects