This commit is contained in:
ditiqi 2025-02-27 09:47:48 +08:00
parent 46db980b0c
commit 8ed1832a79
2 changed files with 7 additions and 10 deletions

View File

@ -60,7 +60,7 @@ export const CourseSyllabus: React.FC<CourseSyllabusProps> = ({
right: 0, right: 0,
top: isHeaderVisible ? "56px" : "0", top: isHeaderVisible ? "56px" : "0",
}} }}
className="fixed top-0 bottom-0 z-10 bg-white shadow-xl"> className="fixed top-0 bottom-0 z-20 bg-white shadow-xl">
{isOpen && ( {isOpen && (
<div className="h-full flex flex-col"> <div className="h-full flex flex-col">
<SyllabusHeader onToggle={onToggle} /> <SyllabusHeader onToggle={onToggle} />

View File

@ -2,7 +2,7 @@ import { Pagination, Empty, Skeleton } from "antd";
import { courseDetailSelect, CourseDto, Prisma } from "@nice/common"; import { courseDetailSelect, CourseDto, Prisma } from "@nice/common";
import { api } from "@nice/client"; import { api } from "@nice/client";
import { DefaultArgs } from "@prisma/client/runtime/library"; import { DefaultArgs } from "@prisma/client/runtime/library";
import { useEffect, useMemo, useState } from "react"; import React, { useEffect, useMemo, useState } from "react";
interface PostListProps { interface PostListProps {
params?: { params?: {
page?: number; page?: number;
@ -12,8 +12,7 @@ interface PostListProps {
}; };
cols?: number; cols?: number;
showPagination?: boolean; showPagination?: boolean;
renderItem: (post: any) => React.ReactNode renderItem: (post: any) => React.ReactNode;
} }
interface PostPagnationProps { interface PostPagnationProps {
data: { data: {
@ -21,13 +20,12 @@ interface PostPagnationProps {
totalPages: number; totalPages: number;
}; };
isLoading: boolean; isLoading: boolean;
} }
export default function PostList({ export default function PostList({
params, params,
cols = 3, cols = 3,
showPagination = true, showPagination = true,
renderItem renderItem,
}: PostListProps) { }: PostListProps) {
const [currentPage, setCurrentPage] = useState<number>(params?.page || 1); const [currentPage, setCurrentPage] = useState<number>(params?.page || 1);
const { data, isLoading }: PostPagnationProps = const { data, isLoading }: PostPagnationProps =
@ -72,9 +70,9 @@ export default function PostList({
{isLoading ? ( {isLoading ? (
<Skeleton paragraph={{ rows: 5 }}></Skeleton> <Skeleton paragraph={{ rows: 5 }}></Skeleton>
) : ( ) : (
posts.map((post) => <div key={post.id}> posts.map((post) => (
{renderItem(post)} <div key={post.id}>{renderItem(post)}</div>
</div>) ))
)} )}
</div> </div>
{showPagination && ( {showPagination && (
@ -91,7 +89,6 @@ export default function PostList({
</> </>
) : ( ) : (
<div className="py-64"> <div className="py-64">
<Empty description="暂无数据" /> <Empty description="暂无数据" />
</div> </div>
)} )}