Last active
November 13, 2023 16:23
-
-
Save souri-t/6094db026bbb1ed086ff4d0ea69ad391 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { TableCell } from "@mui/material"; | |
/** | |
* 編集可能なテーブルセルのプロパティ | |
*/ | |
type Props = { | |
onInput?: (e: React.FormEvent<HTMLTableCellElement>) => void; | |
children?: React.ReactNode; | |
sx?: React.CSSProperties; | |
size?: "small" | "medium"; | |
}; | |
/** | |
* 編集可能なテーブルセル | |
* @param param0 | |
* @returns | |
*/ | |
export const EditableTableCell = ({ onInput, children, sx, size }: Props) => { | |
const handleCellInput = (e: React.FormEvent<HTMLTableCellElement>) => { | |
onInput?.(e); | |
}; | |
return ( | |
<TableCell contentEditable={true} onInput={handleCellInput} sx={sx} size={size} > | |
{children} | |
</TableCell> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment