digitransit-ui/app/component/Message.js
Vesa Meskanen aae81d9005 Implemented new more flexible text component
Message component works also when labelId is not defined.
Not all strings originate from translations.js.
2018-10-10 15:29:20 +03:00

20 lines
467 B
JavaScript

import PropTypes from 'prop-types';
import React from 'react';
import { FormattedMessage } from 'react-intl';
const Message = ({ labelId, defaultMessage }) => {
if (labelId) {
return <FormattedMessage id={labelId} defaultMessage={defaultMessage} />;
}
if (defaultMessage) {
return <span> {defaultMessage} </span>;
}
return null;
};
Message.propTypes = {
labelId: PropTypes.string,
defaultMessage: PropTypes.string,
};
export default Message;