Skip to content

Commit e144db9

Browse files
committed
fix: resolve React 18 key spreading warnings and update deprecated MUI v5 props
Signed-off-by: YASHMAHAKAL <yvsst01@gmail.com>
1 parent 7cb38d2 commit e144db9

4 files changed

Lines changed: 39 additions & 39 deletions

File tree

examples/custom-components/index.js

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,18 @@ import TableViewCol from './TableViewCol';
99
const CustomChip = (props) => {
1010
const { label, onDelete, columnNames, className, index } = props;
1111
return (<Chip
12-
className={className}
13-
variant="outlined"
14-
color={columnNames[index].name === 'Company' ? 'secondary' : 'primary'}
15-
label={label}
16-
onDelete={onDelete}
12+
className={className}
13+
variant="outlined"
14+
color={columnNames[index].name === 'Company' ? 'secondary' : 'primary'}
15+
label={label}
16+
onDelete={onDelete}
1717
/>);
1818
};
1919

2020
const CustomTooltip = (props) => {
2121
return (
22-
<MuiTooltip
23-
title={props.title}
24-
interactive={true}
22+
<MuiTooltip
23+
title={props.title}
2524
TransitionComponent={Fade}
2625
TransitionProps={{ timeout: 250 }}
2726
leaveDelay={250}>{props.children}</MuiTooltip>
@@ -72,31 +71,31 @@ class Example extends React.Component {
7271
return false;
7372
},
7473
display: (filterList, onChange, index, column) => (
75-
<Select
76-
onChange={event => {
77-
filterList[index][0] = event.target.value;
78-
onChange(filterList[index], index, column);
79-
}}
80-
value={filterList[index]}
81-
>
82-
<MenuItem value="Test Corp">{'Test Corp'}</MenuItem>
83-
<MenuItem value="Other Corp">{'Other Corp'}</MenuItem>
84-
</Select>
74+
<Select
75+
onChange={event => {
76+
filterList[index][0] = event.target.value;
77+
onChange(filterList[index], index, column);
78+
}}
79+
value={filterList[index]}
80+
>
81+
<MenuItem value="Test Corp">{'Test Corp'}</MenuItem>
82+
<MenuItem value="Other Corp">{'Other Corp'}</MenuItem>
83+
</Select>
8584
)
8685
},
8786
},
8887
},
8988
{ name: 'City', label: 'City Label', options: { filterList: ['Dallas'] } },
9089
{ name: 'State' },
91-
{
92-
name: 'Empty',
93-
options: {
94-
empty: true,
95-
filterType: 'checkbox',
90+
{
91+
name: 'Empty',
92+
options: {
93+
empty: true,
94+
filterType: 'checkbox',
9695
filterOptions: {
9796
renderValue: (val) => (val ? val : '(Empty)')
9897
}
99-
}
98+
}
10099
},
101100
];
102101
const data = [
@@ -116,16 +115,16 @@ class Example extends React.Component {
116115

117116
return (
118117
<MUIDataTable
119-
title={"ACME Employee list"}
120-
data={data}
121-
columns={columns}
122-
options={options}
123-
components={{
124-
TableFilterList: CustomFilterList,
125-
Tooltip: CustomTooltip,
126-
Checkbox: CustomCheckbox,
127-
TableViewCol: TableViewCol
128-
}}
118+
title={"ACME Employee list"}
119+
data={data}
120+
columns={columns}
121+
options={options}
122+
components={{
123+
TableFilterList: CustomFilterList,
124+
Tooltip: CustomTooltip,
125+
Checkbox: CustomCheckbox,
126+
TableViewCol: TableViewCol
127+
}}
129128
/>
130129
);
131130

examples/customize-footer/CustomFooter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ class CustomFooter extends React.Component {
4444
'aria-label': textLabels.next,
4545
}}
4646
rowsPerPageOptions={[10,20,100]}
47-
onChangePage={this.handlePageChange}
48-
onChangeRowsPerPage={this.handleRowChange}
47+
onPageChange={this.handlePageChange}
48+
onRowsPerPageChange={this.handleRowChange}
4949
/>
5050
</TableCell>
5151
</TableRow>

examples/customize-styling/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ class Example extends React.Component {
192192
},
193193
setTableProps: () => {
194194
return {
195-
padding: this.state.denseTable ? 'none' : 'default',
195+
padding: this.state.denseTable ? 'none' : 'normal',
196196

197197
// material ui v4 only
198198
size: this.state.denseTable ? 'small' : 'medium',

src/components/Popover.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ const Popover = ({ className, trigger, refExit, hide, content, ...providedProps
4545
};
4646

4747
const triggerProps = {
48-
key: 'content',
4948
onClick: (event) => {
5049
if (trigger.props.onClick) trigger.props.onClick();
5150
handleClick(event);
@@ -54,7 +53,9 @@ const Popover = ({ className, trigger, refExit, hide, content, ...providedProps
5453

5554
return (
5655
<>
57-
<span {...triggerProps}>{trigger}</span>
56+
<span key="content" {...triggerProps}>
57+
{trigger}
58+
</span>
5859
<MuiPopover
5960
elevation={2}
6061
open={isOpen}

0 commit comments

Comments
 (0)