WIP network modal
This commit is contained in:
parent
525693fcdc
commit
eef8468d8f
2 changed files with 40 additions and 1 deletions
|
@ -39,7 +39,9 @@
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import { init } from "/tun/tailscale_tun.js";
|
import { init } from "/tun/tailscale_tun.js";
|
||||||
import { showPeers, showLoginURL } from "/tun/test/ui.js";
|
import { showPeers, showLoginURL } from "/tun/test/ui.js";
|
||||||
|
import * as modal from "/webvm/network_modal.js";
|
||||||
|
modal.create(document.body);
|
||||||
|
|
||||||
const { loginURL, ipStack } = await init({
|
const { loginURL, ipStack } = await init({
|
||||||
netMapCallback: showPeers,
|
netMapCallback: showPeers,
|
||||||
dnsIp: "8.8.8.8",
|
dnsIp: "8.8.8.8",
|
||||||
|
|
37
network_modal.js
Normal file
37
network_modal.js
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
export const show = () => {
|
||||||
|
const overlay = document.getElementById("networkModalOverlay");
|
||||||
|
overlay.style.display = "flex";
|
||||||
|
}
|
||||||
|
export const hide = () => {
|
||||||
|
const overlay = document.getElementById("networkModalOverlay");
|
||||||
|
overlay.style.display = "none";
|
||||||
|
}
|
||||||
|
export const create = (parent) => {
|
||||||
|
const html = `
|
||||||
|
<div id="networkModalOverlay" style="width:100%;height:100vh;position:absolute;display:flex ;align-items:center;justify-content:center;background:rgba(0,0,0,0.7);z-index:100">
|
||||||
|
<div id="networkModal" style="max-width:650px;width:100%;background:white;height:400px;display:flex;flex-direction:column;padding:10px">
|
||||||
|
<div class="networkModalHeader">
|
||||||
|
<h2>Modal Pop Up Window</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="networkModalContent">
|
||||||
|
<p>Modal Content</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="networkModalFooter" style="margin-top:auto;">
|
||||||
|
<button id="networkModalClose">Close</button>
|
||||||
|
<button>Save</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
const templ = document.createElement("template");
|
||||||
|
templ.innerHTML = html;
|
||||||
|
parent.prepend(templ.content);
|
||||||
|
parent.querySelector("#networkModalClose").onclick = hide;
|
||||||
|
parent.querySelector("#networkModalOverlay").onclick = (e) => {
|
||||||
|
if (e.target === e.currentTarget)
|
||||||
|
hide();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue