rht
This commit is contained in:
parent
1dd03e5b99
commit
7aea942646
|
@ -1,12 +1,10 @@
|
|||
import React, { useState, useMemo } from "react";
|
||||
import React, { useState, useMemo, ReactNode } from "react";
|
||||
import { Typography, Skeleton } from "antd";
|
||||
import { TaxonomySlug, TermDto } from "@nice/common";
|
||||
import { api } from "@nice/client";
|
||||
import { CoursesSectionTag } from "./CoursesSectionTag";
|
||||
import LookForMore from "./LookForMore";
|
||||
import PostList from "@web/src/components/models/course/list/PostList";
|
||||
import PostCard from "@web/src/components/models/post/PostCard";
|
||||
import CourseCard from "@web/src/components/models/post/SubPost/CourseCard";
|
||||
interface GetTaxonomyProps {
|
||||
categories: string[];
|
||||
isLoading: boolean;
|
||||
|
@ -35,11 +33,15 @@ interface CoursesSectionProps {
|
|||
title: string;
|
||||
description: string;
|
||||
initialVisibleCoursesCount?: number;
|
||||
postType:string;
|
||||
render?:(post)=>ReactNode
|
||||
}
|
||||
const CoursesSection: React.FC<CoursesSectionProps> = ({
|
||||
title,
|
||||
description,
|
||||
initialVisibleCoursesCount = 8,
|
||||
postType,
|
||||
render
|
||||
}) => {
|
||||
const [selectedCategory, setSelectedCategory] = useState<string>("全部");
|
||||
const gateGory: GetTaxonomyProps = useGetTaxonomy({
|
||||
|
@ -83,7 +85,7 @@ const CoursesSection: React.FC<CoursesSectionProps> = ({
|
|||
)}
|
||||
</div>
|
||||
<PostList
|
||||
renderItem={(post) => <CourseCard post={post}></CourseCard>}
|
||||
renderItem={(post) => render(post)}
|
||||
params={{
|
||||
page: 1,
|
||||
pageSize: initialVisibleCoursesCount,
|
||||
|
@ -95,6 +97,7 @@ const CoursesSection: React.FC<CoursesSectionProps> = ({
|
|||
},
|
||||
}
|
||||
: {},
|
||||
type: postType
|
||||
},
|
||||
}}
|
||||
showPagination={false}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
import HeroSection from "./components/HeroSection";
|
||||
import CategorySection from "./components/CategorySection";
|
||||
import CoursesSection from "./components/CoursesSection";
|
||||
import { PostType } from "@nice/common";
|
||||
import PathCard from "@web/src/components/models/post/SubPost/PathCard";
|
||||
import CourseCard from "@web/src/components/models/post/SubPost/CourseCard";
|
||||
|
||||
|
||||
const HomePage = () => {
|
||||
|
@ -8,10 +11,19 @@ const HomePage = () => {
|
|||
return (
|
||||
<div className="min-h-screen">
|
||||
<HeroSection />
|
||||
<CoursesSection
|
||||
title="最受欢迎的思维导图"
|
||||
description="深受追捧的思维导图,点亮你的智慧人生"
|
||||
postType={PostType.PATH}
|
||||
render={(post)=><PathCard post={post}></PathCard>}
|
||||
/>
|
||||
<CoursesSection
|
||||
title="推荐课程"
|
||||
description="最受欢迎的精品课程,助你快速成长"
|
||||
postType={PostType.COURSE}
|
||||
render={(post)=> <CourseCard post={post}></CourseCard>}
|
||||
/>
|
||||
|
||||
<CategorySection />
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -187,7 +187,7 @@ export default function MindEditor({ id }: { id?: string }) {
|
|||
|
||||
return (
|
||||
|
||||
<div className="grid grid-cols-1 flex-col w-[90vw] my-5 h-[80vh] border rounded-lg mx-auto">
|
||||
<div className={`grid grid-cols-1 flex-col w-[90vw] my-5 h-[${Math.floor(window.innerHeight/1.25)}px] border rounded-lg mx-auto`}>
|
||||
|
||||
{canEdit && taxonomies && (
|
||||
<Form
|
||||
|
|
|
@ -70,7 +70,9 @@ export const routes: CustomRouteObject[] = [
|
|||
},
|
||||
{
|
||||
path: "editor/:id?",
|
||||
element: <PathEditorPage></PathEditorPage>,
|
||||
element: <WithAuth>
|
||||
<PathEditorPage></PathEditorPage>
|
||||
</WithAuth>,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue