react-bootstrap#Toast TypeScript Examples

The following examples show how to use react-bootstrap#Toast. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CustomToast.tsx    From devex with GNU General Public License v3.0 6 votes vote down vote up
CustomToast: React.FC<IProps> = (props) => {

  const { setShowToast, isSuccess, bodyText } = props

  return <div
    aria-live="polite"
    aria-atomic="true"
    style={{
      position: 'fixed',
      top: '90px',
      right: '20px',
    }}
  >
    <Toast
      onClose={() => setShowToast(false)}
      show={true}
      delay={3000}
      autohide
      className={isSuccess ? 'custom-toast-success' : 'custom-toast-failure'}
    >
      <Toast.Body className='d-flex' style={{ padding: '0.35rem' }}>
        <span className='mr-2'>
          {
            isSuccess
              ? <FontAwesomeIcon size='lg' className='custom-toast-icon' icon={faCheck} />
              : <FontAwesomeIcon size='lg' className='custom-toast-icon' icon={faTimesCircle} />
          }
        </span>
        <span className='custom-toast-text'>{bodyText}</span>
      </Toast.Body>
    </Toast>
  </div>
}
Example #2
Source File: notification-toast.component.tsx    From cwa-quick-test-frontend with Apache License 2.0 6 votes vote down vote up
NotificationToast = (props: any) => {

    const { t } = useTranslation();

    return (
        <div className='toast-container'>
            <Toast className='qt-notification'
                show={props.show}
                delay={3000}
                autohide
                onClose={() => props.setNotificationShow(false)}
            >
                <ToastHeader closeButton={false} className='qt-notification-header'>
                    <Image src={successIcon} className='mr-3 my-3' />
                    <p className='qt-notification-text my-auto mx-1'>
                        {t('translation:successfull-transferred')}
                    </p>
                </ToastHeader>
            </Toast>
        </div>
    )
}
Example #3
Source File: ToastNotification.tsx    From bada-frame with GNU General Public License v3.0 5 votes vote down vote up
export default function ToastNotification({
    attributes,
    clearAttributes,
}: Iprops) {
    const [show, setShow] = useState(false);
    const closeToast = () => {
        setShow(false);
        clearAttributes();
    };
    useEffect(() => {
        if (!attributes) {
            setShow(false);
        } else {
            setShow(true);
        }
    }, [attributes]);
    return (
        <Wrapper>
            <Toast
                onClose={closeToast}
                show={show}
                delay={AUTO_HIDE_TIME_IN_MILLISECONDS}
                autohide>
                {attributes?.title && (
                    <Toast.Header
                        style={{
                            display: 'flex',
                            alignItems: 'center',
                            justifyContent: 'space-between',
                        }}>
                        <h6 style={{ marginBottom: 0 }}>{attributes.title} </h6>
                    </Toast.Header>
                )}
                {attributes?.message && (
                    <Toast.Body>{attributes.message}</Toast.Body>
                )}
            </Toast>
        </Wrapper>
    );
}