aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/todos/components/TodosWebview.js
blob: 54208d7adc48176f6fd8ad736f2015eea846952b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { observer } from 'mobx-react';
import injectSheet from 'react-jss';
import Webview from 'react-electron-web-view';

const styles = theme => ({
  root: {
    background: theme.colorBackground,
    height: '100%',
    width: 300,
    position: 'absolute',
    top: 0,
    right: 0,
  },
  webview: {
    height: '100%',
  },
});

@injectSheet(styles) @observer
class TodosWebview extends Component {
  static propTypes = {
    classes: PropTypes.object.isRequired,
    authToken: PropTypes.string.isRequired,
  };

  render() {
    const { authToken, classes } = this.props;
    return (
      <div className={classes.root}>
        <Webview
          className={classes.webview}
          src={`http://localhost:4000?authToken=${authToken}`}
        />
      </div>
    );
  }
}

export default TodosWebview;