accounts-ui/imports/ui/components/FormMessage.jsx
2017-01-06 12:59:59 +01:00

20 lines
894 B
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React from 'react';
import { Accounts } from 'meteor/accounts-base';
export class FormMessage extends React.Component {
render () {
let { message, type, className = "message", style = {}, deprecated } = this.props;
// XXX Check for deprecations.
if (deprecated) {
// Found backwords compatibility issue.
console.warn('You are overriding Accounts.ui.Form and using FormMessage, the use of FormMessage in Form has been depreacted in v1.2.11, update your implementation to use FormMessages: https://github.com/studiointeract/accounts-ui/#deprecations');
}
message = _.isObject(message) ? message.message : message; // If message is object, then try to get message from it
return message ? (
<div style={ style } 
className={[ className, type ].join(' ')}>{ message }</div>
) : null;
}
}
Accounts.ui.FormMessage = FormMessage;