2025-06-22 11:34:32 +08:00

127 lines
4.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Link from 'next/link'
import { prisma } from '@/lib/prisma'
import { ComponentCard } from '@/components/ComponentCard'
export default async function Home() {
// 获取每种配件类型的前几个商品
const componentTypes = await prisma.componentType.findMany({
include: {
components: {
take: 6,
orderBy: {
createdAt: 'desc'
}
}
}
})
return (
<div className="min-h-screen bg-gray-50">
{/* Hero Section */}
<section className="bg-gradient-to-r from-blue-600 to-purple-600 text-white py-20">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 text-center">
<h1 className="text-4xl md:text-6xl font-bold mb-6">
PC DIY商城
</h1>
<p className="text-xl md:text-2xl mb-8">
线
</p>
<div className="space-x-4">
<Link
href="/components"
className="bg-white text-blue-600 px-8 py-3 rounded-lg font-semibold hover:bg-gray-100 transition-colors"
>
</Link>
<Link
href="/build"
className="border-2 border-white text-white px-8 py-3 rounded-lg font-semibold hover:bg-white hover:text-blue-600 transition-colors"
>
线
</Link>
</div>
</div>
</section>
{/* Features Section */}
<section className="py-16">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<h2 className="text-3xl font-bold text-center mb-12"></h2>
<div className="grid md:grid-cols-3 gap-8">
<div className="text-center">
<div className="bg-blue-100 w-16 h-16 rounded-full flex items-center justify-center mx-auto mb-4">
<span className="text-2xl">🔧</span>
</div>
<h3 className="text-xl font-semibold mb-2"></h3>
<p className="text-gray-600">
CPU
</p>
</div>
<div className="text-center">
<div className="bg-green-100 w-16 h-16 rounded-full flex items-center justify-center mx-auto mb-4">
<span className="text-2xl">💰</span>
</div>
<h3 className="text-xl font-semibold mb-2"></h3>
<p className="text-gray-600">
</p>
</div>
<div className="text-center">
<div className="bg-purple-100 w-16 h-16 rounded-full flex items-center justify-center mx-auto mb-4">
<span className="text-2xl">🚀</span>
</div>
<h3 className="text-xl font-semibold mb-2">线</h3>
<p className="text-gray-600">
</p>
</div>
</div>
</div>
</section>
{/* Product Categories */}
<section className="py-16 bg-white">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<h2 className="text-3xl font-bold text-center mb-12"></h2>
{componentTypes.map((type) => (
<div key={type.id} className="mb-12">
<div className="flex justify-between items-center mb-6">
<h3 className="text-2xl font-semibold">{type.name}</h3>
<Link
href={`/components?type=${type.id}`}
className="text-blue-600 hover:text-blue-800"
>
</Link>
</div>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
{type.components.map((component) => (
<ComponentCard key={component.id} component={component} />
))}
</div>
</div>
))}
</div>
</section>
{/* CTA Section */}
<section className="py-16 bg-gray-800 text-white">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 text-center">
<h2 className="text-3xl font-bold mb-4"></h2>
<p className="text-xl mb-8">
</p>
<Link
href="/register"
className="bg-blue-600 text-white px-8 py-3 rounded-lg font-semibold hover:bg-blue-700 transition-colors"
>
</Link>
</div>
</section>
</div>
)
}