All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.src.components.Alert.AlertIcon.tsx Maven / Gradle / Ivy

Go to download

This library provides a set of common React components for use with the PatternFly reference implementation.

The newest version!
import * as React from 'react';
import { css } from '@patternfly/react-styles';
import styles from '@patternfly/react-styles/css/components/Alert/alert';
import CheckCircleIcon from '@patternfly/react-icons/dist/esm/icons/check-circle-icon';
import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
import ExclamationTriangleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-triangle-icon';
import InfoCircleIcon from '@patternfly/react-icons/dist/esm/icons/info-circle-icon';
import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';

export const variantIcons = {
  success: CheckCircleIcon,
  danger: ExclamationCircleIcon,
  warning: ExclamationTriangleIcon,
  info: InfoCircleIcon,
  custom: BellIcon
};

export interface AlertIconProps extends React.HTMLProps {
  /** Additional class names added to the alert icon. */
  className?: string;
  /** A custom icon. If not set the icon is set according to the variant. */
  customIcon?: React.ReactNode;
  /** Variant of the alert icon. */
  variant: 'success' | 'danger' | 'warning' | 'info' | 'custom';
}

export const AlertIcon = ({ variant, customIcon, className = '', ...props }: AlertIconProps) => {
  const Icon = variantIcons[variant];
  return Icon ? (
    
{customIcon || }
) : null; };




© 2015 - 2024 Weber Informatics LLC | Privacy Policy