mirror of
https://github.com/cssgunc/compass.git
synced 2025-04-18 17:50:16 -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",
|
"volunteer",
|
||||||
"employee",
|
"employee",
|
||||||
])
|
])
|
||||||
|
|
||||||
const handleRowUpdate = (updatedRow: Resource) => {
|
const handleRowUpdate = (updatedRow: DataPoint) => {
|
||||||
const dataIndex = data.findIndex((row) => row.id === updatedRow.id);
|
const dataIndex = data.findIndex((row) => row.id === updatedRow.id);
|
||||||
if (dataIndex !== -1) {
|
if (dataIndex !== -1) {
|
||||||
const updatedData = [...data];
|
const updatedData = [...data];
|
||||||
|
|
|
@ -1,28 +1,35 @@
|
||||||
import Drawer from "@/components/Drawer/Drawer";
|
import Drawer from "@/components/Drawer/Drawer";
|
||||||
import { ChangeEvent, useState } from "react";
|
import { useState } from "react";
|
||||||
|
import { DataPoint } from "@/components/Table/Table";
|
||||||
export const RowOpenAction = ({ title, rowData, onRowUpdate }) => {
|
|
||||||
const [pageContent, setPageContent] = useState("");
|
type RowOpenActionProps = {
|
||||||
|
title: string,
|
||||||
const handleDrawerContentChange = (newContent) => {
|
rowData: DataPoint,
|
||||||
setPageContent(newContent);
|
onRowUpdate: (updatedRow: DataPoint) => void;
|
||||||
};
|
}
|
||||||
|
|
||||||
return (
|
export const RowOpenAction = ({ title, rowData, onRowUpdate }: RowOpenActionProps) => {
|
||||||
<div className="font-semibold group flex flex-row items-center justify-between pr-2">
|
const [pageContent, setPageContent] = useState("");
|
||||||
{title}
|
|
||||||
<span>
|
const handleDrawerContentChange = (newContent: string) => {
|
||||||
{/* Added OnRowUpdate to drawer */}
|
setPageContent(newContent);
|
||||||
<Drawer
|
};
|
||||||
title="My Drawer Title"
|
|
||||||
editableContent={pageContent}
|
return (
|
||||||
rowContent={rowData}
|
<div className="font-semibold group flex flex-row items-center justify-between pr-2">
|
||||||
onSave={handleDrawerContentChange}
|
{title}
|
||||||
onRowUpdate={onRowUpdate}
|
<span>
|
||||||
>
|
{/* Added OnRowUpdate to drawer */}
|
||||||
{pageContent}
|
<Drawer
|
||||||
</Drawer>
|
title="My Drawer Title"
|
||||||
</span>
|
editableContent={pageContent}
|
||||||
</div>
|
rowContent={rowData}
|
||||||
);
|
onSave={handleDrawerContentChange}
|
||||||
};
|
onRowUpdate={onRowUpdate}
|
||||||
|
>
|
||||||
|
{pageContent}
|
||||||
|
</Drawer>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user