add functionality and refactor the code
This commit is contained in:
@@ -2,11 +2,12 @@ import React from "react";
|
||||
|
||||
interface Props {
|
||||
closeRemapFunction: () => void;
|
||||
renameCallback: (file: any, newName: string) => void;
|
||||
file: any;
|
||||
}
|
||||
|
||||
const Rename = (props: Props) => {
|
||||
const { closeRemapFunction, file } = props;
|
||||
const { closeRemapFunction, file, renameCallback } = props;
|
||||
const [newName, setNewName] = React.useState(file.attributes.name);
|
||||
|
||||
const handleKeyDown = (event: React.KeyboardEvent) => {
|
||||
@@ -19,9 +20,9 @@ const Rename = (props: Props) => {
|
||||
};
|
||||
|
||||
const handleRename = (event: React.MouseEvent) => {
|
||||
// console.log("rename");
|
||||
console.log("Renaming file:", file?.attributes.name, "to", newName);
|
||||
console.log(file);
|
||||
// use from parent function named putRenameFile
|
||||
// renameFunction(file, newName);
|
||||
renameCallback(file, newName);
|
||||
};
|
||||
|
||||
const ref = React.useRef<HTMLDivElement>(null);
|
||||
|
||||
Reference in New Issue
Block a user