2025-02-27 10:23:04 +08:00
|
|
|
import { Card, Tag, Typography, Button } from "antd";
|
2025-02-26 23:18:14 +08:00
|
|
|
import {
|
2025-02-27 10:23:04 +08:00
|
|
|
EyeOutlined
|
2025-02-26 23:18:14 +08:00
|
|
|
} from "@ant-design/icons";
|
|
|
|
import { PostDto, TaxonomySlug } from "@nice/common";
|
|
|
|
import { useNavigate } from "react-router-dom";
|
2025-02-27 10:23:04 +08:00
|
|
|
import DeptInfo from "./DeptInfo";
|
|
|
|
import TermInfo from "./TermInfo";
|
2025-02-26 23:18:14 +08:00
|
|
|
interface pathCardProps {
|
|
|
|
path: PostDto;
|
|
|
|
}
|
|
|
|
const { Title, Text } = Typography;
|
|
|
|
export default function PathCard({ path }: pathCardProps) {
|
|
|
|
const navigate = useNavigate();
|
|
|
|
const handleClick = (path: PostDto) => {
|
|
|
|
navigate(`/path/editor/${path.id}`);
|
2025-02-27 09:47:35 +08:00
|
|
|
window.scrollTo({ top: 0, behavior: "smooth" });
|
2025-02-26 23:18:14 +08:00
|
|
|
};
|
|
|
|
return (
|
|
|
|
<Card
|
|
|
|
onClick={() => handleClick(path)}
|
|
|
|
key={path.id}
|
|
|
|
hoverable
|
2025-02-27 10:23:04 +08:00
|
|
|
className=" group overflow-hidden rounded-xl border border-gray-200 bg-white shadow-xl hover:shadow-2xl transition-all duration-300 transform hover:-translate-y-2"
|
2025-02-26 23:18:14 +08:00
|
|
|
cover={
|
|
|
|
<div className="relative h-56 bg-gradient-to-br from-gray-900 to-gray-800 overflow-hidden">
|
|
|
|
<div
|
|
|
|
className="absolute inset-0 bg-cover bg-center transform transition-all duration-700 ease-out group-hover:scale-110"
|
|
|
|
style={{
|
|
|
|
backgroundImage: `url(${path?.meta?.thumbnail})`,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
{/* <div className="absolute inset-0 bg-gradient-to-t from-black/60 to-transparent opacity-80 group-hover:opacity-60 transition-opacity duration-300" /> */}
|
|
|
|
</div>
|
|
|
|
}>
|
|
|
|
<div className="px-4">
|
2025-02-27 10:23:04 +08:00
|
|
|
<TermInfo path={path} />
|
2025-02-26 23:18:14 +08:00
|
|
|
<Title
|
|
|
|
level={4}
|
|
|
|
className="mb-4 line-clamp-2 font-bold leading-snug text-gray-800 hover:text-blue-600 transition-colors duration-300 group-hover:scale-[1.02] transform origin-left">
|
|
|
|
<button> {path.title}</button>
|
|
|
|
</Title>
|
|
|
|
|
|
|
|
<div className="flex items-center mb-4 p-2 rounded-lg transition-all duration-300 hover:bg-blue-50 group">
|
2025-02-27 10:23:04 +08:00
|
|
|
<DeptInfo path={path} />
|
2025-02-27 09:47:35 +08:00
|
|
|
<span className="flex text-xs font-medium text-gray-500">
|
|
|
|
<EyeOutlined className="mr-2"></EyeOutlined>
|
2025-02-26 23:18:14 +08:00
|
|
|
{path?.meta?.views
|
|
|
|
? `观看次数 ${path?.meta?.views}`
|
2025-02-27 09:47:35 +08:00
|
|
|
: 0}
|
2025-02-26 23:18:14 +08:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div className="pt-4 border-t border-gray-100 text-center">
|
|
|
|
<Button
|
|
|
|
type="primary"
|
|
|
|
size="large"
|
|
|
|
className="w-full shadow-[0_8px_20px_-6px_rgba(59,130,246,0.5)] hover:shadow-[0_12px_24px_-6px_rgba(59,130,246,0.6)]
|
|
|
|
transform hover:translate-y-[-2px] transition-all duration-500 ease-out">
|
|
|
|
立即学习
|
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</Card>
|
|
|
|
);
|
|
|
|
}
|