import { Component, MouseEventHandler, ReactNode } from 'react'; import { observer } from 'mobx-react'; import classnames from 'classnames'; import { defineMessages, injectIntl, WrappedComponentProps } from 'react-intl'; import { mdiClose } from '@mdi/js'; import { noop } from 'lodash'; import Loader from './loader/index'; import Appear from './effects/Appear'; import Icon from './icon'; import { DEFAULT_LOADER_COLOR } from '../../config'; const messages = defineMessages({ hide: { id: 'infobar.hide', defaultMessage: 'Hide', }, }); interface IProps extends WrappedComponentProps { children: ReactNode; onClick?: MouseEventHandler; type?: string; className?: string; ctaLabel?: string; ctaLoading?: boolean; position?: string; sticky?: boolean; onHide?: () => void; } @observer class InfoBar extends Component { render() { const { children, type = 'primary', onClick = noop, className = '', ctaLabel = '', ctaLoading = false, position = 'bottom', sticky = false, onHide = noop, intl, } = this.props; const transitionName = position === 'top' ? 'slideDown' : 'slideUp'; return (
{children} {ctaLabel && ( )} {!sticky && ( )}
); } } export default injectIntl(InfoBar);