diff --git a/frontend/components/AtlasPreviewLoading/AtlasPreviewLoading.js b/frontend/components/AtlasPreviewLoading/AtlasPreviewLoading.js index edb61a6a4..f77984e3a 100644 --- a/frontend/components/AtlasPreviewLoading/AtlasPreviewLoading.js +++ b/frontend/components/AtlasPreviewLoading/AtlasPreviewLoading.js @@ -1,4 +1,5 @@ import React from 'react'; +import ReactCSSTransitionGroup from 'react-addons-css-transition-group'; import styles from './AtlasPreviewLoading.scss'; import classNames from 'classnames/bind'; @@ -6,13 +7,39 @@ const cx = classNames.bind(styles); import { randomInteger } from 'utils/random'; -export default (props) => { +const randomValues = Array.from(new Array(5), () => `${randomInteger(85, 100)}%`); + +export default (_props) => { return ( -
-
 
-
 
-
 
-
 
-
+ +
+
+
 
+
 
+
 
+
 
+
+
+
); -}; \ No newline at end of file +}; diff --git a/frontend/index.js b/frontend/index.js index 95726a801..14e309675 100644 --- a/frontend/index.js +++ b/frontend/index.js @@ -13,6 +13,7 @@ import stores from 'stores'; import 'normalize.css/normalize.css'; import 'styles/base.scss'; import 'styles/fonts.css'; +import 'styles/transitions.scss'; import 'styles/hljs-github-gist.scss'; import 'styles/codemirror.scss'; diff --git a/frontend/scenes/Atlas/Atlas.js b/frontend/scenes/Atlas/Atlas.js index 6047c413f..aff4ec0f0 100644 --- a/frontend/scenes/Atlas/Atlas.js +++ b/frontend/scenes/Atlas/Atlas.js @@ -1,12 +1,13 @@ -import React from 'react'; +import React, { PropTypes } from 'react'; import { observer } from 'mobx-react'; -import { Link, browserHistory } from 'react-router'; -import keydown, { keydownScoped } from 'react-keydown'; +import { browserHistory } from 'react-router'; +import keydown from 'react-keydown'; +import ReactCSSTransitionGroup from 'react-addons-css-transition-group'; import _ from 'lodash'; import store from './AtlasStore'; -import Layout, { Title, HeaderAction } from 'components/Layout'; +import Layout, { Title } from 'components/Layout'; import AtlasPreviewLoading from 'components/AtlasPreviewLoading'; import CenteredContent from 'components/CenteredContent'; import DocumentList from 'components/DocumentList'; @@ -19,10 +20,13 @@ import styles from './Atlas.scss'; @keydown(['c']) @observer class Atlas extends React.Component { + static propTypes = { + params: PropTypes.object.isRequired, + } + componentDidMount = () => { const { id } = this.props.params; store.fetchCollection(id, data => { - // Forward directly to root document if (data.type === 'atlas') { browserHistory.replace(data.navigationTree.url); @@ -72,22 +76,30 @@ class Atlas extends React.Component { titleText={ titleText } > - { store.isFetching ? ( - - ) : ( -
-
-

{ collection.name }

-
- { collection.description } -
+ + { store.isFetching ? ( + + ) : ( +
+
+

{ collection.name }

+
+ { collection.description } +
+
+ + + +
- - - - -
- ) } + ) } + ); diff --git a/frontend/scenes/Dashboard/Dashboard.js b/frontend/scenes/Dashboard/Dashboard.js index a8f19f4cf..f790ccd7b 100644 --- a/frontend/scenes/Dashboard/Dashboard.js +++ b/frontend/scenes/Dashboard/Dashboard.js @@ -1,5 +1,6 @@ import React from 'react'; import { observer } from 'mobx-react'; +import ReactCSSTransitionGroup from 'react-addons-css-transition-group'; import store from './DashboardStore'; @@ -25,11 +26,21 @@ class Dashboard extends React.Component { - { store.isFetching ? ( - - ) : store.collections && store.collections.map((collection) => { - return (); - }) } + + { store.isFetching ? ( + + ) : ( + store.collections && store.collections.map((collection) => { + return (); + }) + ) } + diff --git a/frontend/scenes/DocumentScene/DocumentScene.js b/frontend/scenes/DocumentScene/DocumentScene.js index fb05709b6..44b81858f 100644 --- a/frontend/scenes/DocumentScene/DocumentScene.js +++ b/frontend/scenes/DocumentScene/DocumentScene.js @@ -186,11 +186,7 @@ class DocumentScene extends React.Component { ) } - { this.store.updatingContent ? ( - - ) : ( - - ) } + diff --git a/frontend/styles/transitions.scss b/frontend/styles/transitions.scss new file mode 100644 index 000000000..a78a7234f --- /dev/null +++ b/frontend/styles/transitions.scss @@ -0,0 +1,29 @@ +:global { + .fadeIn-appear { + opacity: 0.01; + } + + .fadeIn-appear.fadeIn-appear-active { + opacity: 1; + transition: opacity 250ms ease-in; + transition-delay: 0.35s; + } + + .fadeIn-enter { + opacity: 0.01; + } + + .fadeIn-enter.fadeIn-enter-active { + opacity: 1; + transition: opacity 200ms ease-in; + } + + .fadeIn-leave { + opacity: 1; + } + + .fadeIn-leave.fadeIn-leave-active { + opacity: 0.01; + transition: opacity 200ms ease-in; + } +} diff --git a/package.json b/package.json index 5f0e3ad63..da5fa5eb3 100644 --- a/package.json +++ b/package.json @@ -124,6 +124,7 @@ "randomstring": "1.1.5", "raw-loader": "^0.5.1", "react": "15.3.1", + "react-addons-css-transition-group": "15.3.1", "react-codemirror": "0.2.6", "react-dom": "15.1.0", "react-dropzone": "3.6.0",