Skip to content

Commit

Permalink
fixup! Feat(web-react): Deprecate icon for danger color in Alert co…
Browse files Browse the repository at this point in the history
…mponent
  • Loading branch information
literat committed Mar 4, 2024
1 parent 82adaf6 commit 1ace288
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/web-react/src/components/Alert/Alert.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import classNames from 'classnames';
import React, { ElementType } from 'react';
import React, { ElementType, useContext } from 'react';
import IconsContext from '../../context/IconsContext';
import { useDeprecationMessage, useStyleProps } from '../../hooks';
import { SpiritAlertProps } from '../../types';
import { Icon } from '../Icon';
Expand All @@ -16,10 +17,11 @@ export const Alert = <T extends ElementType = 'div', E = void>(props: SpiritAler
const { classProps, props: modifiedProps } = useAlertStyleProps({ color, ...restProps });
const { styleProps, props: otherProps } = useStyleProps(modifiedProps);
const alertIconName = useAlertIcon({ color, iconName, ...otherProps });
const icons = useContext(IconsContext);

useDeprecationMessage({
method: 'custom',
trigger: color === 'danger',
trigger: color === 'danger' && (icons == null || icons[alertIconName] == null),
componentName: 'Alert',
customText: `The "warning" icon for the "danger" color is deprecated.
Make sure you have the "danger" icon in your project assets.
Expand Down

0 comments on commit 1ace288

Please sign in to comment.