This commit is contained in:
ditiqi 2025-02-26 10:53:10 +08:00
commit 40c3e2610e
4 changed files with 27 additions and 46 deletions

View File

@ -60,24 +60,6 @@ export default function CourseCard({ course }: CourseCardProps) {
</Tag>
);
})}
{/* <Tag
color="blue"
className="px-3 py-1 rounded-full bg-blue-100 text-blue-600 border-0">
{course.terms?.[0].name}
</Tag>
<Tag
color={
course.terms?.[1].name === "入门"
? "green"
: course.terms?.[1].name === "中级"
? "blue"
: "purple"
}
className="px-3 py-1 rounded-full border-0">
{course.terms?.[1].name}
</Tag> */}
</div>
<Title
@ -103,7 +85,6 @@ export default function CourseCard({ course }: CourseCardProps) {
: null}
</span>
</div>
<div className="pt-4 border-t border-gray-100 text-center">
<Button
type="primary"

View File

@ -41,7 +41,7 @@ const CategorySection = () => {
window.scrollTo({top: 0,behavior: "smooth",})
},[]);
return (
<section className="py-32 relative overflow-hidden">
<section className="py-8 relative overflow-hidden">
<div className="max-w-screen-2xl mx-auto px-4 relative">
<div className="text-center mb-24">
<Title

View File

@ -6,37 +6,37 @@ import { CoursesSectionTag } from "./CoursesSectionTag";
import CourseList from "@web/src/components/models/course/list/CourseList";
import LookForMore from "./LookForMore";
interface GetTaxonomyProps {
categories: string[];
isLoading: boolean;
categories: string[];
isLoading: boolean;
}
function useGetTaxonomy({ type }): GetTaxonomyProps {
const { data, isLoading }: { data: TermDto[]; isLoading: boolean } =
api.term.findMany.useQuery({
where: {
taxonomy: {
slug: type,
},
},
take: 10, // 只取前10个
});
const categories = useMemo(() => {
const allCategories = isLoading
? []
: data?.map((course) => course.name);
return [...Array.from(new Set(allCategories))];
}, [data]);
return { categories, isLoading };
const { data, isLoading }: { data: TermDto[]; isLoading: boolean } =
api.term.findMany.useQuery({
where: {
taxonomy: {
slug: type,
},
},
take: 10, // 只取前10个
});
const categories = useMemo(() => {
const allCategories = isLoading
? []
: data?.map((course) => course.name);
return [...Array.from(new Set(allCategories))];
}, [data]);
return { categories, isLoading };
}
const { Title, Text } = Typography;
interface CoursesSectionProps {
title: string;
description: string;
initialVisibleCoursesCount?: number;
title: string;
description: string;
initialVisibleCoursesCount?: number;
}
const CoursesSection: React.FC<CoursesSectionProps> = ({
title,
description,
initialVisibleCoursesCount = 8,
title,
description,
initialVisibleCoursesCount = 8,
}) => {
const [selectedCategory, setSelectedCategory] = useState<string>("全部");
const gateGory: GetTaxonomyProps = useGetTaxonomy({

View File

@ -9,9 +9,9 @@ const { Content } = Layout;
export function MainLayout() {
return (
<MainProvider>
<Layout className="min-h-screen">
<Layout className="min-h-screen bg-gray-100">
<MainHeader />
<Content className="mt-16 bg-gray-50">
<Content className="mt-16 bg-gray-50 ">
<Outlet />
</Content>
<MainFooter />