import React from 'react'; import PropTypes from 'prop-types'; import Icon from './Icon'; export default class LoginButton extends React.Component { constructor(props) { super(props); window.addEventListener('message', (event) => { this.props.onAuth(event.data); }, false); } login(event) { event.preventDefault(); let loginWindow = window.open('https://juick.com/login?redirect=false', 'Login to Juick', 'width=400,height=300,resizeable=no,menubar=no,toolbar=no,scrollbars=no'); loginWindow.window.focus(); } render() { return ( {this.props.title} ); } } LoginButton.propTypes = { title: PropTypes.string.isRequired, onAuth: PropTypes.func.isRequired };