From ecbc663ef2f9811d504571133f0d9cfa7e363bd0 Mon Sep 17 00:00:00 2001
From: mackt <1033530438@qq.com>
Date: Wed, 10 Apr 2024 09:30:19 +0800
Subject: [PATCH] fix: remove Thumb component.
---
src/components/Journal/JournalList.tsx | 2 +-
src/components/Thumb.tsx | 40 --------------------------
src/components/index.ts | 1 -
3 files changed, 1 insertion(+), 42 deletions(-)
delete mode 100644 src/components/Thumb.tsx
diff --git a/src/components/Journal/JournalList.tsx b/src/components/Journal/JournalList.tsx
index 0a205b4..c8c07da 100644
--- a/src/components/Journal/JournalList.tsx
+++ b/src/components/Journal/JournalList.tsx
@@ -36,7 +36,7 @@ const JournalList = async ({ categoryId, nameCh, journalNoRange, pageNum, pageSi
diff --git a/src/components/Thumb.tsx b/src/components/Thumb.tsx
deleted file mode 100644
index 1353ee8..0000000
--- a/src/components/Thumb.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-'use client';
-
-import { useEffect, useState } from 'react';
-
-import { apiCollect } from '@/services';
-
-interface Props {
- active: boolean;
- id: string;
- type: string;
- size?: number;
- text?: string;
-}
-
-export default function Collect({ active, id, type, size = 24, text = '' }: Props) {
- const [state, setState] = useState(false); // 点赞状态
-
- useEffect(() => {
- setState(active);
- }, [active]);
-
- // 收藏/取消收藏
- const handleCollect = async () => {
- setState(!state); // 更新点赞状态
- const res = await apiCollect({ isAdd: !state, objectId: id, collectType: type });
- if (res.code !== 200) setState(!state); // 如果请求失败,回退状态
- };
-
- return (
-
- {/* 文案 */}
- {!!text &&
{text}
}
- {/* 图标 */}
-
-
-
- );
-}
diff --git a/src/components/index.ts b/src/components/index.ts
index 98bb520..2aa4083 100644
--- a/src/components/index.ts
+++ b/src/components/index.ts
@@ -38,4 +38,3 @@ export { default as CommentHeader } from './Comment/CommentHeader';
export { default as CommentForm } from './Comment/CommentForm';
export { default as CommentItem } from './Comment/CommentItem';
export { default as CommentList } from './Comment/CommentList';
-export { default as Thumb } from './Thumb';