aboutsummaryrefslogtreecommitdiff
path: root/vnext
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-03-02 15:44:24 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:52 +0300
commit96c3e2de18b51259ef0a8bd3562056f3d1f151ad (patch)
tree69bf0ac18932956f3e945077e808b7ba4a3a22a3 /vnext
parentfb44a9cf650889f097701ebf27a8032f3f0fcc20 (diff)
LoginButton component
Diffstat (limited to 'vnext')
-rw-r--r--vnext/src/components/LoginButton.js26
-rw-r--r--vnext/src/components/Navigation.js2
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
+}