diff options
Diffstat (limited to 'vnext/src')
-rw-r--r-- | vnext/src/components/LoginButton.js | 26 | ||||
-rw-r--r-- | vnext/src/components/Navigation.js | 2 |
2 files changed, 27 insertions, 1 deletions
diff --git a/vnext/src/components/LoginButton.js b/vnext/src/components/LoginButton.js new file mode 100644 index 00000000..cdb62e1a --- /dev/null +++ b/vnext/src/components/LoginButton.js @@ -0,0 +1,26 @@ +import React from 'react' +import PropTypes from 'prop-types' + +export default class LoginButton extends React.Component { + constructor(props) { + super(props); + window.addEventListener("message", (event) => { + this.props.onAuth(event.data); + }, false); + } + login() { + 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 ( + <div onClick={this.login}>{this.props.title}</div> + ) + } +}; + +LoginButton.propTypes = { + title: PropTypes.string.isRequired, + onAuth: PropTypes.func.isRequired +}
\ No newline at end of file diff --git a/vnext/src/components/Navigation.js b/vnext/src/components/Navigation.js index 1f0e9483..95693d81 100644 --- a/vnext/src/components/Navigation.js +++ b/vnext/src/components/Navigation.js @@ -39,4 +39,4 @@ export default class Navigation extends React.Component { </header> ) } -}
\ No newline at end of file +} |