Skip to content

Commit 751affd

Browse files
authored
chore(web): support for defaultProps will be removed in react warning (#5561)
1 parent 33f6d43 commit 751affd

File tree

9 files changed

+16
-57
lines changed

9 files changed

+16
-57
lines changed

web/src/components/AirgapUploadProgress.jsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ class AirgapUploadProgress extends Component {
7474

7575
render() {
7676
const {
77-
total,
78-
progress,
77+
total = 0,
78+
progress = 0,
7979
resuming,
8080
onProgressError,
8181
onProgressSuccess,
@@ -345,9 +345,5 @@ class AirgapUploadProgress extends Component {
345345
}
346346
}
347347

348-
AirgapUploadProgress.defaultProps = {
349-
total: 0,
350-
progress: 0,
351-
};
352348

353349
export default AirgapUploadProgress;

web/src/components/shared/CodeSnippet.jsx

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,9 @@ class CodeSnippet extends Component {
2525
dataTestId: PropTypes.string,
2626
};
2727

28-
static defaultProps = {
29-
variant: "plain",
30-
language: "bash",
31-
copyText: "Copy command",
32-
onCopyText: "Copied!",
33-
copyDelay: 3000,
34-
};
3528

3629
copySnippet = () => {
37-
const { children, copyDelay } = this.props;
30+
const { children, copyDelay = 3000 } = this.props;
3831
const textToCopy = Array.isArray(children) ? children.join("\n") : children;
3932

4033
if (navigator.clipboard && window.isSecureContext) {
@@ -88,12 +81,12 @@ class CodeSnippet extends Component {
8881
const {
8982
className,
9083
children,
91-
language,
84+
language = "bash",
9285
preText,
9386
canCopy,
94-
copyText,
95-
onCopyText,
96-
variant,
87+
copyText = "Copy command",
88+
onCopyText = "Copied!",
89+
variant = "plain",
9790
trimWhitespace = true,
9891
dataTestId,
9992
} = this.props;

web/src/components/shared/PaperIcon/PaperIcon.jsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import classNames from "classnames";
33
import "@src/scss/components/shared/PaperIcon.scss";
44

55
export default function PaperIcon(props) {
6-
const { iconClass, className, onClick, height, width } = props;
6+
const { iconClass, className, onClick, height = "25px", width = "25px" } = props;
77

88
return (
99
<div
@@ -20,7 +20,3 @@ export default function PaperIcon(props) {
2020
);
2121
}
2222

23-
PaperIcon.defaultProps = {
24-
height: "25px",
25-
width: "25px",
26-
};

web/src/components/shared/SideBar/SideBar.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,12 @@ import "@src/scss/components/shared/SideBar.scss";
66

77
interface Props {
88
className?: string;
9-
items: (JSX.Element | undefined)[];
9+
items?: (JSX.Element | undefined)[];
1010
loading?: boolean;
1111
}
1212
class SideBar extends Component<Props> {
13-
static defaultProps = {
14-
items: [],
15-
};
16-
1713
render() {
18-
const { className, items, loading } = this.props;
14+
const { className, items = [], loading } = this.props;
1915

2016
if (loading) {
2117
return (

web/src/components/shared/SubNavBar/SubNavBar.jsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import subNavConfig from "@src/config-ui/subNavConfig";
88
export default function SubNavBar({
99
className,
1010
activeTab,
11-
app,
11+
app = {},
1212
isVeleroInstalled,
1313
isAccess = false,
1414
isSnapshots = false,
@@ -143,10 +143,6 @@ export default function SubNavBar({
143143
);
144144
}
145145

146-
SubNavBar.defaultProps = {
147-
app: {},
148-
};
149-
150146
SubNavBar.propTypes = {
151147
className: PropTypes.string,
152148
activeTab: PropTypes.string,

web/src/components/shared/TabView/TabView.jsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,8 @@ export default class TabView extends Component {
2424
onTabChange: PropTypes.func,
2525
};
2626

27-
static defaultProps = {
28-
separator: "|",
29-
onTabChange: () => {},
30-
};
31-
3227
setTab = (name) => {
33-
const { onTabChange } = this.props;
28+
const { onTabChange = () => {} } = this.props;
3429

3530
this.setState(
3631
{
@@ -41,7 +36,7 @@ export default class TabView extends Component {
4136
};
4237

4338
render() {
44-
const { className, children, separator } = this.props;
39+
const { className, children, separator = "|" } = this.props;
4540
const { currentTab } = this.state;
4641
const childToRender = Children.toArray(children).find(
4742
(child) => child.props.name === currentTab

web/src/components/shared/Tooltip.jsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,9 @@ export default class Tooltip extends Component {
1212
minWidth: PropTypes.string,
1313
};
1414

15-
static defaultProps = {
16-
position: "top-center",
17-
minWidth: "80",
18-
};
1915

2016
render() {
21-
const { className, visible, text, content, position, minWidth } =
17+
const { className, visible, text, content, position = "top-center", minWidth = "80" } =
2218
this.props;
2319

2420
const wrapperClass = `Tooltip-wrapper tooltip-${position} ${

web/src/components/snapshots/SnapshotStorageDestination.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,6 @@ class SnapshotStorageDestination extends Component<Props, State> {
336336
};
337337
}
338338

339-
static defaultProps = {
340-
snapshotSettings: {
341-
store: {},
342-
},
343-
};
344339

345340
componentDidMount() {
346341
if (this.props.snapshotSettings && !this.props.checkForVeleroAndNodeAgent) {

web/src/features/Dashboard/components/AirgapUploadProgress.jsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ class AirgapUploadProgress extends Component {
7474

7575
render() {
7676
const {
77-
total,
78-
progress,
77+
total = 0,
78+
progress = 0,
7979
resuming,
8080
onProgressError,
8181
onProgressSuccess,
@@ -345,9 +345,5 @@ class AirgapUploadProgress extends Component {
345345
}
346346
}
347347

348-
AirgapUploadProgress.defaultProps = {
349-
total: 0,
350-
progress: 0,
351-
};
352348

353349
export default AirgapUploadProgress;

0 commit comments

Comments
 (0)