aboutsummaryrefslogtreecommitdiff
path: root/src_frontend/Components/Dialogs
diff options
context:
space:
mode:
authorJakob Stendahl <jakob.stendahl@outlook.com>2021-09-19 19:43:11 +0200
committerJakob Stendahl <jakob.stendahl@outlook.com>2021-09-19 19:43:11 +0200
commit7bdce37fd3f18e2712e18c4e2c64cac69af0aca1 (patch)
treeb7ad3f1cca92e2dfd2664ae9e65652bd03ff58b2 /src_frontend/Components/Dialogs
parente6880cd8ccf82d993f222cb14b4860581654acb8 (diff)
downloadLuxcena-Neo-7bdce37fd3f18e2712e18c4e2c64cac69af0aca1.tar.gz
Luxcena-Neo-7bdce37fd3f18e2712e18c4e2c64cac69af0aca1.zip
:boom: Introduce new UI based on svelte, and rewrite a lot of the node app and the NeoRuntime
Diffstat (limited to 'src_frontend/Components/Dialogs')
-rw-r--r--src_frontend/Components/Dialogs/ConfirmActionDialog.svelte59
1 files changed, 59 insertions, 0 deletions
diff --git a/src_frontend/Components/Dialogs/ConfirmActionDialog.svelte b/src_frontend/Components/Dialogs/ConfirmActionDialog.svelte
new file mode 100644
index 0000000..185c743
--- /dev/null
+++ b/src_frontend/Components/Dialogs/ConfirmActionDialog.svelte
@@ -0,0 +1,59 @@
+<script>
+ import { onMount } from "svelte";
+ import dialogPolyfill from 'dialog-polyfill'
+ import Button from "../../ComponentLib/Button/Button.svelte";
+
+ export let title = "Are you sure?";
+ export let text = "Are you sure you want to delete the galaxy?";
+ export let defaultAction = false;
+ export let action = () => console.log("No action specified");
+
+ let modal;
+ let activeTab = 0;
+ let name;
+ let sourceMode;
+
+ function open() {
+ modal.showModal()
+ }
+ function confirm() {
+ modal.close();
+ action();
+ }
+ function register(node) {
+ dialogPolyfill.registerDialog(node);
+ }
+</script>
+
+<style>
+ dialog {
+ padding: 15px;
+ border: none;
+ border-radius: 15px;
+ }
+ h2 {
+ margin: 0;
+ }
+ .buttons {
+ display: flex;
+ }
+ .buttons > * {
+ flex-grow: 1;
+ }
+ .buttons > *:not(:last-child) {
+ margin-right: 5px;
+ }
+ .buttons > *:not(:first-child) {
+ margin-left: 5px;
+ }
+</style>
+
+<slot name="trigger" {open}></slot>
+<dialog bind:this={modal} use:register>
+ <h2>{title}</h2>
+ <p>{text}</p>
+ <div class="buttons">
+ <div><Button fullWidth=true on:click={confirm} color={"var(--theme-primary)"} backgroundColor={"white"}>Yes</Button></div>
+ <div><Button fullWidth=true on:click={() => modal.close() }>No</Button></div>
+ </div>
+</dialog> \ No newline at end of file