make config optional, safe SX access
This commit is contained in:
1 parent
83dc96887d
commit
3d067e8030
1 file changed
+3
-3
@@ -62,8 +62,8 @@ const DataTable = ({ headers, data, config }) => {
|
|||||||
return (
|
return (
|
||||||
<TableRow
|
<TableRow
|
||||||
key={row.id}
|
key={row.id}
|
||||||
sx={config.rowSX}
|
sx={config?.rowSX ?? {}}
|
||||||
onClick={() => config.onRowClick(row)}
|
onClick={() => config?.onRowClick(row)}
|
||||||
>
|
>
|
||||||
{headers.map((header, index) => {
|
{headers.map((header, index) => {
|
||||||
return (
|
return (
|
||||||
@@ -96,7 +96,7 @@ DataTable.propTypes = {
|
|||||||
config: PropTypes.shape({
|
config: PropTypes.shape({
|
||||||
onRowClick: PropTypes.func.isRequired,
|
onRowClick: PropTypes.func.isRequired,
|
||||||
rowSX: PropTypes.object,
|
rowSX: PropTypes.object,
|
||||||
}).isRequired,
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default DataTable;
|
export default DataTable;
|
||||||
Reference in new issue
Block a user