Vulcan/packages/example-membership/lib/components/pics/PicsHome.jsx

48 lines
1,009 B
React
Raw Normal View History

2017-07-26 08:02:16 +09:00
/*
Pics Home component
*/
import React from 'react';
import { Components, withCurrentUser } from 'meteor/vulcan:core';
import PicsList from './PicsList.jsx';
import Users from 'meteor/vulcan:users';
import Button from 'react-bootstrap/lib/Button';
const PicsHome = ({results = [], currentUser, loading, loadMore, count, totalCount}) => {
if (currentUser) {
return (
<div className="pics-list">
{Users.canDo(currentUser, 'pics.view') ?
<PicsList /> :
<Components.Checkout
productKey="membership"
associatedCollection={Users}
associatedDocument={currentUser}
fragmentName="UsersCurrent"
button={<Button bsStyle="primary">Buy membership</Button>}
/>
}
</div>
)
} else {
return (
<div className="pics-list">
<p>Please sign up or log in to access this content</p>
</div>
)
}
};
export default withCurrentUser(PicsHome);