This commit is contained in:
Rao 2025-02-27 23:11:37 +08:00
parent 711ab6290e
commit f1d4733d2a
3 changed files with 11 additions and 4 deletions

View File

@ -34,14 +34,16 @@ interface CoursesSectionProps {
description: string;
initialVisibleCoursesCount?: number;
postType:string;
render?:(post)=>ReactNode
render?:(post)=>ReactNode;
to:string
}
const CoursesSection: React.FC<CoursesSectionProps> = ({
title,
description,
initialVisibleCoursesCount = 8,
postType,
render
render,
to
}) => {
const [selectedCategory, setSelectedCategory] = useState<string>("全部");
const gateGory: GetTaxonomyProps = useGetTaxonomy({
@ -102,7 +104,7 @@ const CoursesSection: React.FC<CoursesSectionProps> = ({
}}
showPagination={false}
cols={4}></PostList>
<LookForMore to={"/courses"}></LookForMore>
<LookForMore to={to}></LookForMore>
</div>
</section>
);

View File

@ -11,7 +11,10 @@ export default function LookForMore({to}:{to:string}) {
<div className="flex justify-end">
<Button
type="link"
onClick={() => navigate(to)}
onClick={() => {
navigate(to)
window.scrollTo({top: 0,behavior: "smooth"});
}}
className="flex items-center gap-2 text-gray-600 hover:text-blue-600 font-medium transition-colors duration-300">
<ArrowRightOutlined />

View File

@ -16,12 +16,14 @@ const HomePage = () => {
description="深受追捧的思维导图,点亮你的智慧人生"
postType={PostType.PATH}
render={(post)=><PathCard post={post}></PathCard>}
to={"path"}
/>
<CoursesSection
title="推荐课程"
description="最受欢迎的精品课程,助你快速成长"
postType={PostType.COURSE}
render={(post)=> <CourseCard post={post}></CourseCard>}
to={"/courses"}
/>
<CategorySection />