diff --git a/client/stylesheets/_extends.scss b/client/stylesheets/_extends.scss deleted file mode 100644 index c136454..0000000 --- a/client/stylesheets/_extends.scss +++ /dev/null @@ -1,13 +0,0 @@ -%clearfix { - *zoom: 1; - - &:before, - &:after { - display: table; - content: ""; - } - - &:after { - clear: both; - } -} diff --git a/client/stylesheets/application.scss b/client/stylesheets/application.scss index a89b7d4..2902b5d 100644 --- a/client/stylesheets/application.scss +++ b/client/stylesheets/application.scss @@ -1,5 +1,4 @@ -@import "extends"; - +@import "base/extends"; @import "base/animations"; @import "base/forms"; diff --git a/client/stylesheets/base/_extends.scss b/client/stylesheets/base/_extends.scss new file mode 100644 index 0000000..c136454 --- /dev/null +++ b/client/stylesheets/base/_extends.scss @@ -0,0 +1,13 @@ +%clearfix { + *zoom: 1; + + &:before, + &:after { + display: table; + content: ""; + } + + &:after { + clear: both; + } +} diff --git a/imports/ui/components/loading.js b/imports/ui/components/loading.js new file mode 100644 index 0000000..ba75e0d --- /dev/null +++ b/imports/ui/components/loading.js @@ -0,0 +1,28 @@ +import React from 'react'; + +export const Loading = () => ( + + + + + +); diff --git a/imports/ui/containers/documents-list.js b/imports/ui/containers/documents-list.js index 6c5674f..ea8a860 100644 --- a/imports/ui/containers/documents-list.js +++ b/imports/ui/containers/documents-list.js @@ -1,13 +1,16 @@ import { composeWithTracker } from 'react-komposer'; import { Documents } from '../../api/documents/documents.js'; import { DocumentsList } from '../components/documents-list.js'; +import { Loading } from '../components/loading.js'; const composer = (params, onReady) => { const subscription = Meteor.subscribe('documents'); if (subscription.ready()) { const documents = Documents.find().fetch(); - onReady(null, { documents }); + // setTimeout is used to visually buffer the loading spinner so it's not + // jarring. Can just call onReady directly if you wish :) + setTimeout(() => { onReady(null, { documents }); }, 500); } }; -export default composeWithTracker(composer)(DocumentsList); +export default composeWithTracker(composer, Loading)(DocumentsList);