2016-01-03 23:18:42 +02:00
import React , { Component } from 'react' ;
2016-01-18 07:28:43 +02:00
import { connect } from 'react-redux' ;
import { TransitionMotion , spring } from 'react-motion' ;
2016-01-03 23:18:42 +02:00
import AppInfo from 'components/auth/AppInfo' ;
import styles from './auth.scss' ;
2016-01-19 07:16:03 +02:00
const springConfig = [ 200 , 20 ] ;
2016-01-18 07:28:43 +02:00
class AuthPage extends Component {
2016-01-16 14:06:22 +02:00
displayName = 'AuthPage' ;
2016-01-03 23:18:42 +02:00
render ( ) {
var appInfo = {
name : 'TLauncher' ,
2016-01-04 08:02:13 +02:00
description : ` Лучший альтернативный лаунчер для Minecraft с большим количеством версий и их модификаций, а также возмоностью входа как с лицензионным аккаунтом, так и без него. `
2016-01-03 23:18:42 +02:00
} ;
2016-01-18 07:28:43 +02:00
var { path , children } = this . props ;
2016-01-03 23:18:42 +02:00
return (
< div >
< div className = { styles . sidebar } >
< AppInfo { ...appInfo } / >
< / div >
< div className = { styles . content } >
2016-01-18 07:28:43 +02:00
< TransitionMotion
willEnter = { this . willEnter }
willLeave = { this . willLeave }
styles = { {
[ path ] : {
children ,
2016-01-19 07:16:03 +02:00
x : spring ( 0 , springConfig )
2016-01-18 07:28:43 +02:00
}
} }
>
{ ( 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 08:21:02 +02:00
left : 0 ,
2016-01-18 07:28:43 +02:00
width : '100%' ,
2016-01-19 08:21:02 +02:00
transform : ` translateX( ${ x } %) `
2016-01-18 07:28:43 +02:00
} ;
return (
< div key = { path } style = { style } >
{ children }
< / div >
) ;
} ) }
< / div >
) }
< / TransitionMotion >
2016-01-03 23:18:42 +02:00
< / div >
< / div >
) ;
}
2016-01-18 07:28:43 +02:00
willEnter ( key , styles ) {
return {
... styles ,
2016-01-19 07:16:03 +02:00
x : spring ( 100 , springConfig )
2016-01-18 07:28:43 +02:00
} ;
}
willLeave ( key , styles ) {
return {
... styles ,
2016-01-19 07:16:03 +02:00
x : spring ( - 100 , springConfig )
2016-01-18 07:28:43 +02:00
} ;
}
2016-01-03 23:18:42 +02:00
}
2016-01-18 07:28:43 +02:00
export default connect ( ( state ) => ( {
path : state . routing . location . pathname
} ) ) ( AuthPage ) ;