mirror of
https://github.com/cssgunc/compass.git
synced 2025-04-09 14:00:15 -04:00
Fixed type errors for RowOpenAction
This commit is contained in:
parent
d027efc434
commit
6a454c809f
|
@ -18,8 +18,8 @@ export function ResourceTable({ resources }: { resources: Resource[] }) {
|
|||
"volunteer",
|
||||
"employee",
|
||||
])
|
||||
|
||||
const handleRowUpdate = (updatedRow: Resource) => {
|
||||
|
||||
const handleRowUpdate = (updatedRow: DataPoint) => {
|
||||
const dataIndex = data.findIndex((row) => row.id === updatedRow.id);
|
||||
if (dataIndex !== -1) {
|
||||
const updatedData = [...data];
|
||||
|
|
|
@ -1,28 +1,35 @@
|
|||
import Drawer from "@/components/Drawer/Drawer";
|
||||
import { ChangeEvent, useState } from "react";
|
||||
|
||||
export const RowOpenAction = ({ title, rowData, onRowUpdate }) => {
|
||||
const [pageContent, setPageContent] = useState("");
|
||||
|
||||
const handleDrawerContentChange = (newContent) => {
|
||||
setPageContent(newContent);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="font-semibold group flex flex-row items-center justify-between pr-2">
|
||||
{title}
|
||||
<span>
|
||||
{/* Added OnRowUpdate to drawer */}
|
||||
<Drawer
|
||||
title="My Drawer Title"
|
||||
editableContent={pageContent}
|
||||
rowContent={rowData}
|
||||
onSave={handleDrawerContentChange}
|
||||
onRowUpdate={onRowUpdate}
|
||||
>
|
||||
{pageContent}
|
||||
</Drawer>
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
import Drawer from "@/components/Drawer/Drawer";
|
||||
import { useState } from "react";
|
||||
import { DataPoint } from "@/components/Table/Table";
|
||||
|
||||
type RowOpenActionProps = {
|
||||
title: string,
|
||||
rowData: DataPoint,
|
||||
onRowUpdate: (updatedRow: DataPoint) => void;
|
||||
}
|
||||
|
||||
export const RowOpenAction = ({ title, rowData, onRowUpdate }: RowOpenActionProps) => {
|
||||
const [pageContent, setPageContent] = useState("");
|
||||
|
||||
const handleDrawerContentChange = (newContent: string) => {
|
||||
setPageContent(newContent);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="font-semibold group flex flex-row items-center justify-between pr-2">
|
||||
{title}
|
||||
<span>
|
||||
{/* Added OnRowUpdate to drawer */}
|
||||
<Drawer
|
||||
title="My Drawer Title"
|
||||
editableContent={pageContent}
|
||||
rowContent={rowData}
|
||||
onSave={handleDrawerContentChange}
|
||||
onRowUpdate={onRowUpdate}
|
||||
>
|
||||
{pageContent}
|
||||
</Drawer>
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user