From 96c3e2de18b51259ef0a8bd3562056f3d1f151ad Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 2 Mar 2018 15:44:24 +0300 Subject: LoginButton component --- vnext/src/components/LoginButton.js | 26 ++++++++++++++++++++++++++ vnext/src/components/Navigation.js | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 vnext/src/components/LoginButton.js (limited to 'vnext/src/components') 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 ( +
{this.props.title}
+ ) + } +}; + +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 { ) } -} \ No newline at end of file +} -- cgit v1.2.3