48 lines
1.1 KiB
TypeScript
Raw Permalink Normal View History

2026-06-22 14:43:46 +08:00
import { ReactNode } from 'react';
import Link from 'next/link';
import { cn } from '@/lib/utils';
interface SectionProps {
title: string;
subtitle?: string;
moreText?: string;
moreHref?: string;
className?: string;
children: ReactNode;
}
export function Section({
title,
subtitle,
moreText = '查看更多',
moreHref,
className,
children,
}: SectionProps) {
return (
<section className={cn('bg-white py-12', className)}>
<div className="container-page">
<div className="mb-8 flex items-end justify-between">
<div>
<h2 className="text-2xl font-bold text-slate-900 sm:text-3xl">
{title}
</h2>
{subtitle && (
<p className="mt-2 text-sm text-slate-500">{subtitle}</p>
)}
</div>
{moreHref && (
<Link
href={moreHref}
className="text-sm text-brand-600 transition-colors hover:text-brand-700"
>
{moreText}
</Link>
)}
</div>
{children}
</div>
</section>
);
}