-
Notifications
You must be signed in to change notification settings - Fork 66
/
index.htm
53 lines (29 loc) · 1.34 KB
/
index.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-material-design/4.0.2/bootstrap-material-design.css" />
<link rel="stylesheet" href="./index.css" />
<script src="../../dist/login-zoid-component.popup.js"></script>
</head>
<body>
<h3>Log in</h3>
<!-- Button to open the popup -->
<button id="popupLogin" class="btn btn-primary">Popup Log In</button>
<!-- Container to display the result of the login call -->
<div id="result"></div>
<script>
// To render a popup we need to wait for a click event
document.querySelector('#popupLogin').addEventListener('click', function () {
// Hide the button
document.querySelector('#popupLogin').style.display = 'none';
// Render the component and pass down props to the popup
zoidlogin.LoginZoidComponent({
env: 'demo',
prefilledEmail: '[email protected]',
// When the iframe window calls `window.xprops.onLogin(email)` this callback will be called
onLogin: function(email) {
// Display the email address that was used to log in
document.querySelector('#result').innerText = email + ' logged in!';
}
}).render();
});
</script>
</body>