import { Pencil, Trash2 } from 'lucide-react'; import { AttachmentPreviewDialog } from '@/components/attachment-preview-dialog'; import { RowActions } from '@/components/row-actions'; import { Badge } from '@/components/ui/badge'; import type { Material } from '@/types/material'; type CreateCardParams = { handleEdit: (material: Material) => void; handleDeleteClick: (material: Material) => void; canUpdate: boolean; canDelete: boolean; }; export function createMaterialCard(params: CreateCardParams) { const { handleEdit, handleDeleteClick, canUpdate, canDelete } = params; return function MaterialCard(material: Material) { const courseClass = material.course_class; return (
{material.meeting_number && ( Pertemuan {material.meeting_number} )}
{material.file_url && material.file_name && ( )} , show: canUpdate, onClick: () => handleEdit(material), }, { label: 'Hapus', icon: ( ), show: canDelete, onClick: () => handleDeleteClick(material), }, ]} />

{material.title}

{material.description && (

{material.description}

)}

{courseClass ? `${courseClass.course?.code ?? ''} ${courseClass.course?.name ?? ''}` : '-'}

); }; }