Skip to content

Commit ba22fc1

Browse files
authored
Merge pull request #47 from YASHMAHAKAL/fix-react-warnings
Resolve React key-spread warnings and update deprecated MUI v7 props
2 parents 7cb38d2 + 5802ea2 commit ba22fc1

File tree

4 files changed

+50
-46
lines changed

4 files changed

+50
-46
lines changed

examples/custom-components/index.js

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,20 @@ 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}
25-
TransitionComponent={Fade}
26-
TransitionProps={{ timeout: 250 }}
22+
<MuiTooltip
23+
title={props.title}
24+
slots={{ transition: Fade }}
25+
slotProps={{ transition: { timeout: 250 } }}
2726
leaveDelay={250}>{props.children}</MuiTooltip>
2827
);
2928
};
@@ -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: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,19 @@ class CustomFooter extends React.Component {
3737
page={page}
3838
labelRowsPerPage={textLabels.rowsPerPage}
3939
labelDisplayedRows={({ from, to, count }) => `${from}-${to} ${textLabels.displayRows} ${count}`}
40-
backIconButtonProps={{
41-
'aria-label': textLabels.previous,
42-
}}
43-
nextIconButtonProps={{
44-
'aria-label': textLabels.next,
40+
slotProps={{
41+
actions: {
42+
previousButton: {
43+
'aria-label': textLabels.previous,
44+
},
45+
nextButton: {
46+
'aria-label': textLabels.next,
47+
}
48+
}
4549
}}
4650
rowsPerPageOptions={[10,20,100]}
47-
onChangePage={this.handlePageChange}
48-
onChangeRowsPerPage={this.handleRowChange}
51+
onPageChange={this.handlePageChange}
52+
onRowsPerPageChange={this.handleRowChange}
4953
/>
5054
</TableCell>
5155
</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)