Skip to content

Commit 0de64b6

Browse files
committed
re-name utility to avoid rule of hooks
1 parent 2fcbe58 commit 0de64b6

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.2.26",
2+
"version": "0.2.27",
33
"license": "MIT",
44
"main": "dist/index.js",
55
"typings": "dist/index.d.ts",

src/alert/Alert.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { classNames } from '../utils';
55
import { Text } from '../content';
66
import { Icon, CloseOutline } from '../icon';
77
import { useSeverityStyle } from './useSeverityStyle';
8-
import { useSeverityIcon } from './useSeverityIcon';
8+
import { getSeverityIcon } from './getSeverityIcon';
99
import { SeverityLevel } from '../types';
1010
export interface AlertProps {
1111
variant: SeverityLevel;
@@ -57,7 +57,7 @@ export const Alert = ({
5757
let variantStyle = useSeverityStyle(variant);
5858

5959
if (!icon && showIcon) {
60-
icon = useSeverityIcon(variant);
60+
icon = getSeverityIcon(variant);
6161
}
6262
return (
6363
<div

src/alert/useSeverityIcon.tsx renamed to src/alert/getSeverityIcon.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type IconOptions = {
1919
*/
2020
filled?: boolean;
2121
};
22-
export function useSeverityIcon(
22+
export function getSeverityIcon(
2323
severity: SeverityLevel,
2424
{ filled }: IconOptions = { filled: true }
2525
) {

src/notification/Notice.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { css } from '@emotion/core';
33
import { NoticeConfig } from './types';
44
import { Text } from '../content';
55
import { useSeverityStyle } from '../alert/useSeverityStyle';
6-
import { useSeverityIcon } from '../alert/useSeverityIcon';
6+
import { getSeverityIcon } from '../alert/getSeverityIcon';
77
import { Icon, CloseOutline } from '../icon';
88
import theme from '../theme';
99
import { DEFAULT_EXPIRE_MS } from './constants';
@@ -38,6 +38,7 @@ export function Notice({
3838
return () => clearTimeout(timer);
3939
}
4040
return () => {}; // Void function
41+
// eslint-disable-next-line react-hooks/exhaustive-deps
4142
}, []);
4243

4344
// Get the styles for the specific variant
@@ -64,7 +65,7 @@ export function Notice({
6465
}
6566
`}
6667
>
67-
{useSeverityIcon(variant)}
68+
{getSeverityIcon(variant)}
6869

6970
<Text elementType="h5" textSize="large" weight="heavy" color="inherit">
7071
{title}

0 commit comments

Comments
 (0)