2016-01-04 02:48:42 +05:30
import React , { Component } from 'react' ;
2016-01-18 10:58:43 +05:30
import { connect } from 'react-redux' ;
import { TransitionMotion , spring } from 'react-motion' ;
2016-01-04 02:48:42 +05:30
import AppInfo from 'components/auth/AppInfo' ;
import styles from './auth.scss' ;
2016-01-19 10:46:03 +05:30
const springConfig = [ 200 , 20 ] ;
2016-01-18 10:58:43 +05:30
class AuthPage extends Component {
2016-01-16 17:36:22 +05:30
displayName = 'AuthPage' ;
2016-01-04 02:48:42 +05:30
render ( ) {
var appInfo = {
name : 'TLauncher' ,
2016-01-04 11:32:13 +05:30
description : ` Лучший альтернативный лаунчер для Minecraft с большим количеством версий и их модификаций, а также возмоностью входа как с лицензионным аккаунтом, так и без него. `
2016-01-04 02:48:42 +05:30
} ;
2016-01-18 10:58:43 +05:30
var { path , children } = this . props ;
2016-01-04 02:48:42 +05:30
return (
< div >
< div className = { styles . sidebar } >
< AppInfo { ...appInfo } / >
< / div >
< div className = { styles . content } >
2016-01-18 10:58:43 +05:30
< TransitionMotion
willEnter = { this . willEnter }
willLeave = { this . willLeave }
styles = { {
[ path ] : {
children ,
2016-01-19 10:46:03 +05:30
x : spring ( 0 , springConfig )
2016-01-18 10:58:43 +05:30
}
} }
>
{ ( items ) => (
< div style = { { position : 'relative' , overflow : 'hidden' , width : '100%' , height : '600px' } } >
{ Object . keys ( items ) . map ( ( path ) => {
const { children , x } = items [ path ] ;
const style = {
position : 'absolute' ,
top : 0 ,
2016-01-19 11:51:02 +05:30
left : 0 ,
2016-01-18 10:58:43 +05:30
width : '100%' ,
2016-01-19 11:51:02 +05:30
transform : ` translateX( ${ x } %) `
2016-01-18 10:58:43 +05:30
} ;
return (
< div key = { path } style = { style } >
{ children }
< / div >
) ;
} ) }
< / div >
) }
< / TransitionMotion >
2016-01-04 02:48:42 +05:30
< / div >
< / div >
) ;
}
2016-01-18 10:58:43 +05:30
willEnter ( key , styles ) {
return {
... styles ,
2016-01-19 10:46:03 +05:30
x : spring ( 100 , springConfig )
2016-01-18 10:58:43 +05:30
} ;
}
willLeave ( key , styles ) {
return {
... styles ,
2016-01-19 10:46:03 +05:30
x : spring ( - 100 , springConfig )
2016-01-18 10:58:43 +05:30
} ;
}
2016-01-04 02:48:42 +05:30
}
2016-01-18 10:58:43 +05:30
export default connect ( ( state ) => ( {
path : state . routing . location . pathname
} ) ) ( AuthPage ) ;