mirror of
https://github.com/vale981/Vulcan
synced 2025-03-10 12:36:39 -04:00
22 lines
No EOL
693 B
JavaScript
22 lines
No EOL
693 B
JavaScript
import Telescope from 'meteor/nova:lib';
|
|
import React, { PropTypes } from 'react';
|
|
import Users from 'meteor/nova:users';
|
|
import withCurrentUser from '../containers/withCurrentUser.js';
|
|
|
|
const ShowIf = props => {
|
|
const { check, document, failureComponent = null, currentUser, children } = props;
|
|
return check(currentUser, document) ? children : failureComponent;
|
|
};
|
|
|
|
ShowIf.propTypes = {
|
|
check: React.PropTypes.func.isRequired,
|
|
currentUser: React.PropTypes.object,
|
|
document: React.PropTypes.object,
|
|
failureComponent: React.PropTypes.object,
|
|
};
|
|
|
|
ShowIf.displayName = "ShowIf";
|
|
|
|
Telescope.registerComponent('ShowIf', ShowIf, withCurrentUser);
|
|
|
|
export default withCurrentUser(ShowIf); |