diff options
author | Vitaly Takmazov | 2018-03-02 15:44:24 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-01-13 10:37:52 +0300 |
commit | 96c3e2de18b51259ef0a8bd3562056f3d1f151ad (patch) | |
tree | 69bf0ac18932956f3e945077e808b7ba4a3a22a3 /vnext | |
parent | fb44a9cf650889f097701ebf27a8032f3f0fcc20 (diff) |
LoginButton component
Diffstat (limited to 'vnext')
-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 +} |