fix: remove Thumb component.

mack-mac
mackt 7 months ago
parent b433662dba
commit ecbc663ef2

@ -36,7 +36,7 @@ const JournalList = async ({ categoryId, nameCh, journalNoRange, pageNum, pageSi
<div className="flex flex-row items-center justify-between"> <div className="flex flex-row items-center justify-between">
<div className="text-[17px] leading-[23.8px]">{nameCh}</div> <div className="text-[17px] leading-[23.8px]">{nameCh}</div>
<div className="flex flex-row items-center cursor-pointer"> <div className="flex flex-row items-center cursor-pointer">
<Image className="mr-[6px]" width={24} height={24} src={'/img/icon/fm.svg'} alt="FM" /> <Image className="mr-[6px]" width={24} height={24} src={'/img/icon/FM.svg'} alt="FM" />
<p className="text-[15px] leading-[21px] cursor-pointer hover:text-brand"></p> <p className="text-[15px] leading-[21px] cursor-pointer hover:text-brand"></p>
</div> </div>
</div> </div>

@ -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<boolean>(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 (
<div className="flex flex-row items-center gap-[9px] cursor-pointer group" onClick={handleCollect}>
{/* 文案 */}
{!!text && <p className="text-[rgba(0,0,0,0.4)] text-[13px] leading-[18.2px] group-hover:text-brand">{text}</p>}
{/* 图标 */}
<div
className={`w-[${size}px] h-[${size}px] ${state ? 'bg-[url(/img/icon/thumb-active.svg)]' : 'bg-[url(/img/icon/thumb.svg)]'} group-hover:bg-[url(/img/icon/thumb-active.svg)]`}
/>
</div>
);
}

@ -38,4 +38,3 @@ export { default as CommentHeader } from './Comment/CommentHeader';
export { default as CommentForm } from './Comment/CommentForm'; export { default as CommentForm } from './Comment/CommentForm';
export { default as CommentItem } from './Comment/CommentItem'; export { default as CommentItem } from './Comment/CommentItem';
export { default as CommentList } from './Comment/CommentList'; export { default as CommentList } from './Comment/CommentList';
export { default as Thumb } from './Thumb';

Loading…
Cancel
Save