11import React , { cloneElement , Component , PropTypes } from 'react' ;
2+ import { sendToBg } from 'crossmessaging' ;
23import styles from 'remotedev-app/lib/styles' ;
34import Instances from 'remotedev-app/lib/components/Instances' ;
45import Button from 'remotedev-app/lib/components/Button' ;
56import SettingsIcon from 'react-icons/lib/md/settings' ;
7+ import LeftIcon from 'react-icons/lib/md/border-left' ;
8+ import RightIcon from 'react-icons/lib/md/border-right' ;
9+ import BottomIcon from 'react-icons/lib/md/border-bottom' ;
610import Monitor from './Monitor' ;
711
12+ let monitorPosition ;
13+ if ( location . hash ) monitorPosition = location . hash . substr ( location . hash . indexOf ( '-' ) + 1 ) ;
14+
815export default class App extends Component {
916 static propTypes = {
1017 store : PropTypes . object
@@ -17,6 +24,10 @@ export default class App extends Component {
1724 this . props . store . setInstance ( this . props . store . instance , true ) ;
1825 } ;
1926
27+ openWindow = ( position ) => {
28+ sendToBg ( { type : 'OPEN' , position } ) ;
29+ } ;
30+
2031 render ( ) {
2132 const { store, ...childProps } = this . props ;
2233 return (
@@ -29,6 +40,24 @@ export default class App extends Component {
2940 < Monitor { ...childProps } />
3041 { chrome . runtime . openOptionsPage ?
3142 < div style = { styles . buttonBar } >
43+ { monitorPosition !== 'left' ?
44+ < Button
45+ Icon = { LeftIcon }
46+ onClick = { ( ) => { this . openWindow ( 'left' ) ; } }
47+ />
48+ : null }
49+ { monitorPosition !== 'right' ?
50+ < Button
51+ Icon = { RightIcon }
52+ onClick = { ( ) => { this . openWindow ( 'right' ) ; } }
53+ />
54+ : null }
55+ { monitorPosition !== 'bottom' ?
56+ < Button
57+ Icon = { BottomIcon }
58+ onClick = { ( ) => { this . openWindow ( 'bottom' ) ; } }
59+ />
60+ : null }
3261 < Button
3362 Icon = { SettingsIcon }
3463 onClick = { ( ) => { chrome . runtime . openOptionsPage ( ) ; } }
0 commit comments