From ea8ad329a2d39ef3ecb137df57b5b8fe1de66110 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 21 Sep 2020 14:49:01 +0100 Subject: [PATCH] don't use warning --- packages/material-ui-lab/src/Alert/Alert.d.ts | 1 + packages/material-ui-lab/src/Alert/Alert.js | 26 +++++++++---------- .../src/AlertTitle/AlertTitle.d.ts | 1 + .../src/AlertTitle/AlertTitle.js | 26 +++++++++---------- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/packages/material-ui-lab/src/Alert/Alert.d.ts b/packages/material-ui-lab/src/Alert/Alert.d.ts index e761cb5c2ac815..7dca614cfefb44 100644 --- a/packages/material-ui-lab/src/Alert/Alert.d.ts +++ b/packages/material-ui-lab/src/Alert/Alert.d.ts @@ -1,2 +1,3 @@ import Alert from '@material-ui/core/Alert'; + export default Alert; diff --git a/packages/material-ui-lab/src/Alert/Alert.js b/packages/material-ui-lab/src/Alert/Alert.js index f71dce6dbacf0b..e15e2229123781 100644 --- a/packages/material-ui-lab/src/Alert/Alert.js +++ b/packages/material-ui-lab/src/Alert/Alert.js @@ -1,23 +1,21 @@ import React from 'react'; -import warning from 'warning'; import Alert from '@material-ui/core/Alert'; -let warnedOnce = false; - export default React.forwardRef(function DeprecatedAlert(props, ref) { + let warnedOnce = false; - warning( - warnOnce, + if (!warnedOnce) { + console.warn( + [ + 'Material-UI: the Alert component was moved from the lab to the core.', + '', + "You should use `import { Alert } from '@material-ui/core'`", + "or `import Alert from '@material-ui/core/Alert'`", + ].join('\n'), + ); - [ - 'Material-UI: the Alert component was moved from the lab to the core.', - '', - "You should use `import { Alert } from '@material-ui/core'`", - "or `import Alert from '@material-ui/core/Alert'`", - ].join('\n'), - ); - - warnOnce = true; + warnedOnce = true; + } return ; }); diff --git a/packages/material-ui-lab/src/AlertTitle/AlertTitle.d.ts b/packages/material-ui-lab/src/AlertTitle/AlertTitle.d.ts index e636fcee3cdfd2..b19569472d820e 100644 --- a/packages/material-ui-lab/src/AlertTitle/AlertTitle.d.ts +++ b/packages/material-ui-lab/src/AlertTitle/AlertTitle.d.ts @@ -1,2 +1,3 @@ import AlertTitle from '@material-ui/core/AlertTitle'; + export default AlertTitle; diff --git a/packages/material-ui-lab/src/AlertTitle/AlertTitle.js b/packages/material-ui-lab/src/AlertTitle/AlertTitle.js index 77c08fd55ddbb0..f39ae66b7aae44 100644 --- a/packages/material-ui-lab/src/AlertTitle/AlertTitle.js +++ b/packages/material-ui-lab/src/AlertTitle/AlertTitle.js @@ -1,21 +1,21 @@ import React from 'react'; -import warning from 'warning'; import AlertTitle from '@material-ui/core/AlertTitle'; export default React.forwardRef(function DeprecatedAlertTitle(props, ref) { - let warnOnce = false; + let warnedOnce = false; - warning( - warnOnce, - [ - 'Material-UI: the AlertTitle component was moved from the lab to the core.', - '', - "You should use `import { AlertTitle } from '@material-ui/core'`", - "or `import AlertTitle from '@material-ui/core/AlertTitle'`", - ].join('\n'), - ); - - warnOnce = true; + if (!warnedOnce) { + console.warn( + [ + 'Material-UI: the AlertTitle component was moved from the lab to the core.', + '', + "You should use `import { AlertTitle } from '@material-ui/core'`", + "or `import AlertTitle from '@material-ui/core/AlertTitle'`", + ].join('\n'), + ); + + warnedOnce = true; + } return ; });