diff options
author | sdtsui <szehungdanieltsui@gmail.com> | 2017-08-03 08:49:04 +0800 |
---|---|---|
committer | sdtsui <szehungdanieltsui@gmail.com> | 2017-08-03 08:49:04 +0800 |
commit | 8a39ef03c298f846171173c38912d3386d688af2 (patch) | |
tree | cfecacdabc9cb1726e09530a871519b4aeb25f2e /ui/app/app.js | |
parent | 84aba21ae9f00d5d82d8087de6938fa9526bd3d4 (diff) | |
download | tangerine-wallet-browser-8a39ef03c298f846171173c38912d3386d688af2.tar tangerine-wallet-browser-8a39ef03c298f846171173c38912d3386d688af2.tar.gz tangerine-wallet-browser-8a39ef03c298f846171173c38912d3386d688af2.tar.bz2 tangerine-wallet-browser-8a39ef03c298f846171173c38912d3386d688af2.tar.lz tangerine-wallet-browser-8a39ef03c298f846171173c38912d3386d688af2.tar.xz tangerine-wallet-browser-8a39ef03c298f846171173c38912d3386d688af2.tar.zst tangerine-wallet-browser-8a39ef03c298f846171173c38912d3386d688af2.zip |
Hook up css animation
Diffstat (limited to 'ui/app/app.js')
-rw-r--r-- | ui/app/app.js | 109 |
1 files changed, 68 insertions, 41 deletions
diff --git a/ui/app/app.js b/ui/app/app.js index 3279e0333..9bda4966d 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -35,6 +35,7 @@ const QrView = require('./components/qr-code') const HDCreateVaultComplete = require('./keychains/hd/create-vault-complete') const HDRestoreVaultScreen = require('./keychains/hd/restore-vault') const RevealSeedConfirmation = require('./keychains/hd/recover-seed/confirmation') +const ReactCSSTransitionGroup = require('react-addons-css-transition-group') module.exports = connect(mapStateToProps)(App) @@ -119,49 +120,75 @@ App.prototype.render = function () { } App.prototype.renderSidebar = function() { - if (!this.props.sidebarOpen) { - return null; - } + // if (!this.props.sidebarOpen) { + // return null; + // } - return h('div.phone-visible', {}, [ - // content - h(WalletView, { - responsiveDisplayClassname: '.phone-visible', - style: { - zIndex: 26, - position: 'fixed', - top: '6%', - left: '0px', - right: '0px', - bottom: '0px', - opacity: '1', - visibility: 'visible', - transition: 'transform 0.3s ease-out', - willChange: 'transform', - transform: 'translateX(0%)', - overflowY: 'auto', - boxShadow: 'rgba(0, 0, 0, 0.15) 2px 2px 4px', - width: '85%', - height: '100%', - }, - }), - - // overlay - // TODO: add onClick for overlay to close sidebar - h('div', { - style: { - zIndex: 25, - position: 'fixed', - top: '6%', - left: '0px', - right: '0px', - bottom: '0px', - opacity: '1', - visibility: 'visible', - transition: 'opacity 0.3s ease-out, visibility 0.3s ease-out', - backgroundColor: 'rgba(0, 0, 0, 0.3)', + return h('div', { + }, [ + h('style', ` + .sidebar-enter { + transition: transform 500ms ease-in-out; + transform: translateX(-100%); + } + .sidebar-enter.sidebar-enter-active { + transition: transform 500ms ease-in-out; + transform: translateX(0%); + } + .sidebar-leave { + transition: transform 500ms ease-in-out; + transform: translateX(0%); } - }, []) + .sidebar-leave.sidebar-leave-active { + transition: transform 500ms ease-in-out; + transform: translateX(-100%); + } + `), + + h(ReactCSSTransitionGroup, { + transitionName: 'sidebar', + transitionEnterTimeout: 500, + transitionLeaveTimeout: 500, + }, [ + // content + this.props.sidebarOpen ? h(WalletView, { + responsiveDisplayClassname: '.sidebar', + style: { + zIndex: 26, + position: 'fixed', + top: '6%', + left: '0px', + right: '0px', + bottom: '0px', + opacity: '1', + visibility: 'visible', + // transition: 'transform 1s ease-in', + willChange: 'transform', + // transform: 'translateX(300px)', + overflowY: 'auto', + boxShadow: 'rgba(0, 0, 0, 0.15) 2px 2px 4px', + width: '85%', + height: '100%', + }, + }) : undefined, + + // overlay + // TODO: add onClick for overlay to close sidebar + this.props.sidebarOpen ? h('div', { + style: { + zIndex: 25, + position: 'fixed', + top: '6%', + left: '0px', + right: '0px', + bottom: '0px', + opacity: '1', + visibility: 'visible', + // transition: 'opacity 0.3s ease-out, visibility 0.3s ease-out', + backgroundColor: 'rgba(0, 0, 0, 0.3)', + } + }, []) : undefined, + ]) ]) } |