feat: pass document id as prop to the actions component

This commit is contained in:
Ephraim Atta-Duncan
2023-07-04 00:59:25 +00:00
parent 86b0d5ee9c
commit f61bf00702
3 changed files with 7 additions and 7 deletions

View File

@@ -84,8 +84,8 @@ export default async function DashboardPage() {
<TableCell>
<LocaleDate date={document.created} />
</TableCell>
<TableCell>
<ActionButtons />
<TableCell className="flex cursor-pointer gap-6">
<ActionButtons documentId={document.id} />
</TableCell>
</TableRow>
))}

View File

@@ -63,7 +63,7 @@ export const DocumentsDataTable = ({ results }: DocumentsDataTableProps) => {
{
header: 'Actions',
accessorKey: 'actions',
cell: () => <ActionButtons />,
cell: ({ row }) => <ActionButtons documentId={row.original.id} />,
},
]}
data={results.data}

View File

@@ -4,28 +4,28 @@ import React from 'react';
import { Download, Edit, Trash } from 'lucide-react';
export function ActionButtons() {
export function ActionButtons({ documentId }: { documentId: number }) {
return (
<div className="flex cursor-pointer gap-6">
<Edit
size={18}
color="#71717A"
onClick={() => {
console.log('Edit Button');
console.log('Edit Document with id: ', documentId);
}}
/>
<Download
size={18}
color="#71717A"
onClick={() => {
console.log('Download Button');
console.log('Download Document with id: ', documentId);
}}
/>
<Trash
size={18}
color="#71717A"
onClick={() => {
console.log('Delete Button');
console.log('Delete Document with id: ', documentId);
}}
/>
</div>