34 lines
807 B
TypeScript
34 lines
807 B
TypeScript
import { TemplateCard } from './TemplateCard';
|
|
|
|
interface Template {
|
|
id: string;
|
|
title: string;
|
|
// type: string;
|
|
description: string;
|
|
updateTime: string;
|
|
// useCount: number;
|
|
// rating: number;
|
|
category: string;
|
|
file_path?: string;
|
|
file_format?: string;
|
|
}
|
|
|
|
interface TemplateGridProps {
|
|
templates: Template[];
|
|
viewMode: 'grid' | 'list';
|
|
onTemplateClick: (templateId: string) => void;
|
|
}
|
|
|
|
export function TemplateGrid({ templates, viewMode, onTemplateClick }: TemplateGridProps) {
|
|
return (
|
|
<div className={`template-grid ${viewMode === 'list' ? 'list-view' : ''}`}>
|
|
{templates.map((template) => (
|
|
<TemplateCard
|
|
key={template.id}
|
|
template={template}
|
|
onClick={() => onTemplateClick(template.id)}
|
|
/>
|
|
))}
|
|
</div>
|
|
);
|
|
}
|