/*
* This file demonstrates a basic ReactXP app.
*/

import RX = require('reactxp');

import ContentPanel from './ContentPanel';
import DrawerControl = require('./DrawerControl');
import DrawerPanel from './DrawerPanel';

const _drawerRef = 'drawer';

class App extends RX.Component<{}, null> {
    render() {
        return (
            <DrawerControl
                ref={ _drawerRef }
                renderContent={ () => { return <ContentPanel onToggleDrawer={ this._onToggleDrawer } /> } }
                renderDrawer={ () => { return <DrawerPanel /> } }
            />
        );
    }

    private _onToggleDrawer = () => {
        let drawer = this.refs[_drawerRef] as DrawerControl;
        if (drawer) {
            drawer.toggleDrawer();
        }
    }
}

export = App;
