Skip to content

Commit c80dd09

Browse files
committed
Add hooks and warnings.ts
1 parent 2a23310 commit c80dd09

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/deprecated/warnings.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export const PromoDeprecationWarning =
2+
'The Promo component is deprecated, and will be removed in the next major version of nhsuk-react-components. The Card component is the intended replacement.';
3+
4+
export const PanelDeprecationWarning =
5+
'The Promo component is deprecated, and will be removed in the next major version of nhsuk-react-components. The Card component is the intended replacement.';

src/util/hooks/UseDevWarning.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { useEffect } from 'react';
2+
import isDev from '../IsDev';
3+
4+
const useDevWarning = (warning: string) => {
5+
useEffect(() => {
6+
if (isDev()) {
7+
// eslint-disable-next-line no-console
8+
console.warn(warning);
9+
}
10+
}, []);
11+
};
12+
13+
export default useDevWarning;

0 commit comments

Comments
 (0)