-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ebd9565
commit f9e18f4
Showing
5 changed files
with
124 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<script lang="ts"> | ||
export let title: string = null; | ||
export let isOpen: boolean = false; | ||
export let onClose: () => void = null; | ||
export let showXButton: boolean = true; | ||
const onCloseClicked = () => { | ||
isOpen = false; | ||
if (onClose) { | ||
onClose(); | ||
} | ||
}; | ||
</script> | ||
|
||
<svelte:window | ||
on:keydown={function (e) { | ||
if (e.key === "Escape") { | ||
onCloseClicked(); | ||
} | ||
}} | ||
/> | ||
|
||
<div class="modal bg-black/60" class:modal-open={isOpen}> | ||
<div class="modal-box bg-dark-3"> | ||
<h3 class="font-bold text-lg text-center mt-4">{title}</h3> | ||
{#if showXButton} | ||
<div class="modal-action mt-0"> | ||
<button | ||
type="button" | ||
class="btn btn-sm btn-circle absolute right-2 top-2 cursor-pointer font-sans text-lg" | ||
on:click={onCloseClicked} | ||
> | ||
× | ||
</button> | ||
</div> | ||
{/if} | ||
<div class="modal-body"> | ||
<slot /> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<style> | ||
.modal { | ||
align-items: center; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script lang="ts"> | ||
import { QuestionMarkCircle } from "svelte-heros-v2"; | ||
export let isOpen: boolean = false; | ||
</script> | ||
|
||
<QuestionMarkCircle | ||
on:click={() => (isOpen = true)} | ||
size="18" | ||
variation="outline" | ||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<script lang="ts"> | ||
import Modal from "./Modal.svelte"; | ||
export let title: string; | ||
export let isOpen: boolean = false; | ||
</script> | ||
|
||
<Modal {title} bind:isOpen> | ||
<div class="flex h-full min-h-tooltip-modal w-full flex-col justify-between"> | ||
<div class="tip-body mb-4 flex-auto"> | ||
<slot name="body" /> | ||
</div> | ||
<div class="tip-footer self-start"> | ||
<slot name="footer" /> | ||
</div> | ||
</div> | ||
</Modal> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters