forked from GraphQLGuide/news
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/VulcanJS/Vulcan-Starter
- Loading branch information
Showing
12 changed files
with
142 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 19 additions & 29 deletions
48
packages/example-movies/lib/components/movies/MoviesList.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,52 @@ | ||
/* | ||
List of movies. | ||
Wrapped with the "withList" and "withCurrentUser" containers. | ||
Wrapped with the "withMulti" and "withCurrentUser" containers. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { registerComponent, Components, withList, withCurrentUser, Loading } from 'meteor/vulcan:core'; | ||
import Helmet from 'react-helmet'; | ||
import { registerComponent, replaceComponent, Components, withMulti, withCurrentUser, Loading } from 'meteor/vulcan:core'; | ||
|
||
import Movies from '../../modules/movies/collection.js'; | ||
|
||
const MoviesList = ({results = [], currentUser, loading, loadMore, count, totalCount}) => | ||
|
||
<div style={{maxWidth: '500px', margin: '20px auto'}}> | ||
|
||
<Helmet> | ||
<link name="bootstrap" rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css"/> | ||
</Helmet> | ||
|
||
const MoviesList = ({ results = [], currentUser, loading, loadMore, count, totalCount, refetch }) => ( | ||
<div style={{ maxWidth: '500px', margin: '20px auto' }}> | ||
{/* user accounts */} | ||
|
||
<div style={{padding: '20px 0', marginBottom: '20px', borderBottom: '1px solid #ccc'}}> | ||
|
||
<div style={{ padding: '20px 0', marginBottom: '20px', borderBottom: '1px solid #ccc' }}> | ||
<Components.AccountsLoginForm /> | ||
|
||
</div> | ||
|
||
{loading ? | ||
|
||
<Loading /> : | ||
|
||
{loading ? ( | ||
<Loading /> | ||
) : ( | ||
<div className="movies"> | ||
|
||
{/* new document form */} | ||
|
||
<Components.MoviesNewForm /> | ||
<Components.MoviesNewForm refetch={refetch} /> | ||
|
||
{/* documents list */} | ||
|
||
{results.map(movie => <Components.MoviesItem key={movie._id} movie={movie} currentUser={currentUser} />)} | ||
|
||
{results.map(movie => { | ||
return <Components.MoviesItem key={movie._id} movie={movie} currentUser={currentUser} refetch={refetch} />; | ||
})} | ||
|
||
{/* load more */} | ||
|
||
{totalCount > results.length ? | ||
{ totalCount > results.length ? | ||
<a href="#" onClick={e => {e.preventDefault(); loadMore();}}>Load More ({count}/{totalCount})</a> : | ||
<p>No more items.</p> | ||
} | ||
|
||
} | ||
</div> | ||
} | ||
|
||
)} | ||
</div> | ||
); | ||
|
||
const options = { | ||
collection: Movies, | ||
fragmentName: 'MoviesItemFragment', | ||
limit: 5 | ||
limit: 5, | ||
}; | ||
|
||
registerComponent('MoviesList', MoviesList, withCurrentUser, [withList, options]); | ||
registerComponent({ name: 'MoviesList', component: MoviesList, hocs: [withCurrentUser, [withMulti, options]] }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.