feat: 优化项目网站 UI/UX 并新增项目详情组件
- 重构首页和项目列表页布局,优化视觉层次 - 新增 ProjectDetail、ProjectSidebar、RelatedProjects 组件 - 改进项目卡片样式,增加悬停效果 - 优化标签云和搜索栏交互体验 - 更新全局样式和 Tailwind 配置 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -16,31 +16,86 @@ interface ProjectCardProps {
|
||||
}>
|
||||
}
|
||||
locale: string
|
||||
featured?: boolean
|
||||
}
|
||||
|
||||
export function ProjectCard({ project, locale }: ProjectCardProps) {
|
||||
// Icon mapping for projects based on tags
|
||||
function getProjectIcon(tags: Array<{ name: string }>): string {
|
||||
const tagNames = tags.map(t => t.name.toLowerCase())
|
||||
if (tagNames.some(t => t.includes('automation') || t.includes('workflow'))) return '⚙️'
|
||||
if (tagNames.some(t => t.includes('image') || t.includes('art'))) return '🎨'
|
||||
if (tagNames.some(t => t.includes('chat') || t.includes('assistant'))) return '💬'
|
||||
if (tagNames.some(t => t.includes('data') || t.includes('analysis'))) return '📊'
|
||||
if (tagNames.some(t => t.includes('llm') || t.includes('language'))) return '🧠'
|
||||
return '✨'
|
||||
}
|
||||
|
||||
export function ProjectCard({ project, locale, featured = false }: ProjectCardProps) {
|
||||
const icon = getProjectIcon(project.tags)
|
||||
const displayName = locale === 'en' && project.nameEn ? project.nameEn : project.name
|
||||
const displayDescription = locale === 'en' && project.descriptionEn ? project.descriptionEn : project.description
|
||||
|
||||
return (
|
||||
<div className="border rounded-lg p-6 hover:shadow-lg transition-shadow">
|
||||
<h3 className="text-xl font-semibold mb-2">{project.name}</h3>
|
||||
<p className="text-muted-foreground mb-4 line-clamp-2">{project.description}</p>
|
||||
|
||||
<div className="flex flex-wrap gap-2 mb-4">
|
||||
{project.tags.map((tag) => (
|
||||
<span
|
||||
key={tag.id}
|
||||
className="inline-flex items-center px-2 py-1 rounded text-xs bg-secondary text-secondary-foreground"
|
||||
>
|
||||
{tag.name}
|
||||
</span>
|
||||
))}
|
||||
<article
|
||||
className={`bg-white dark:bg-surface-dark border-2 border-black dark:border-gray-600 p-6 ${
|
||||
featured ? 'shadow-neo hover:shadow-neo-hover hover:-translate-y-1' : 'shadow-neo-sm'
|
||||
} transition-all duration-200 flex flex-col h-full group`}
|
||||
>
|
||||
{/* Card Header */}
|
||||
<div className="flex justify-between items-start mb-4">
|
||||
<h3 className="font-display text-xl md:text-2xl font-bold">{displayName}</h3>
|
||||
<span className="text-2xl group-hover:rotate-12 transition-transform">{icon}</span>
|
||||
</div>
|
||||
|
||||
|
||||
{/* Card Description */}
|
||||
<p className="text-gray-600 dark:text-gray-300 mb-6 flex-grow font-sans leading-relaxed text-sm md:text-base line-clamp-3">
|
||||
{displayDescription}
|
||||
</p>
|
||||
|
||||
{/* Card Footer */}
|
||||
<div className="mt-auto">
|
||||
{/* Tags */}
|
||||
<div className="flex flex-wrap gap-2 mb-4">
|
||||
{project.tags.slice(0, 3).map((tag) => (
|
||||
<span
|
||||
key={tag.id}
|
||||
className="bg-gray-100 dark:bg-gray-800 px-2 py-1 text-[10px] uppercase font-display font-bold border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-300"
|
||||
>
|
||||
{tag.name}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* View Details Link */}
|
||||
<Link
|
||||
href={`/${locale}/projects/${project.slug}`}
|
||||
className="inline-flex items-center font-display font-bold text-sm uppercase hover:text-secondary dark:hover:text-primary group"
|
||||
>
|
||||
VIEW DETAILS{' '}
|
||||
<span className="ml-1 transform group-hover:translate-x-1 transition-transform">→</span>
|
||||
</Link>
|
||||
</div>
|
||||
</article>
|
||||
)
|
||||
}
|
||||
|
||||
// Special card for "Submit Your Project" CTA
|
||||
export function SubmitProjectCard({ locale }: { locale: string }) {
|
||||
return (
|
||||
<article className="bg-primary border-2 border-black dark:border-gray-600 p-6 shadow-neo hover:shadow-neo-hover hover:-translate-y-1 transition-all duration-200 flex flex-col h-full justify-center items-center text-center group">
|
||||
<div className="bg-white dark:bg-black p-4 rounded-full border-2 border-black mb-4 group-hover:scale-110 transition-transform">
|
||||
<span className="text-3xl dark:text-primary">+</span>
|
||||
</div>
|
||||
<h3 className="font-display text-xl md:text-2xl font-bold text-black mb-2">Submit Your Project</h3>
|
||||
<p className="text-black mb-6 font-sans text-sm px-4">
|
||||
Have an AI tool worth sharing? Add it to Agent Park.
|
||||
</p>
|
||||
<Link
|
||||
href={`/${locale}/projects/${project.slug}`}
|
||||
className="text-primary hover:underline text-sm font-medium"
|
||||
href="#"
|
||||
className="bg-black text-white dark:bg-black dark:text-primary border-2 border-black dark:border-black px-6 py-2 font-display text-sm font-bold uppercase hover:bg-white hover:text-black dark:hover:bg-white dark:hover:text-black transition-colors"
|
||||
>
|
||||
查看详情 →
|
||||
SUBMIT NOW
|
||||
</Link>
|
||||
</div>
|
||||
</article>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user