-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR adds sveltestrap. This will allow easier ui composition and lower styling/logic boilerplate. I brought back the accordion in the dev mode modal and simplified the base component of all modals. In a next step maybe modals could have their own state handling. * Add sveltestrap dependency * Use accordion component in DeveloperModeModal * Use modal component from sveltestrap Co-authored-by: Johannah Sprinz <[email protected]>
- Loading branch information
1 parent
101e3f0
commit 5a09ca7
Showing
10 changed files
with
83 additions
and
110 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -1,80 +1,31 @@ | ||
<script> | ||
import { createEventDispatcher } from "svelte"; | ||
import { fade, fly } from "svelte/transition"; | ||
import { | ||
Button, | ||
Modal, | ||
ModalBody, | ||
ModalFooter, | ||
ModalHeader | ||
} from "sveltestrap"; | ||
export let showCloseButton = true; | ||
export let isOpen = false; | ||
const dispatch = createEventDispatcher(); | ||
const close = () => dispatch("close"); | ||
</script> | ||
|
||
<div class="svelte-modal-background" in:fade out:fade /> | ||
|
||
<div | ||
class="svelte-modal" | ||
role="dialog" | ||
aria-modal="true" | ||
in:fly={{ y: -200, duration: 500 }} | ||
out:fly={{ y: -200, duration: 500 }} | ||
> | ||
<div class="svelte-modal-header"> | ||
<Modal {isOpen}> | ||
<ModalHeader> | ||
<slot name="header" /> | ||
</div> | ||
<div class="svelte-modal-content"> | ||
<slot name="content" /> | ||
</div> | ||
<div class="svelte-modal-actions"> | ||
</ModalHeader> | ||
<ModalBody> | ||
<slot name="content" class="svelte-modal-content" /> | ||
</ModalBody> | ||
<ModalFooter> | ||
{#if showCloseButton} | ||
<button class="btn btn-default" on:click={close}>Close</button> | ||
<Button color="primary" on:click={close}>Close</Button> | ||
{/if} | ||
<slot name="actions" /> | ||
</div> | ||
</div> | ||
|
||
<style> | ||
.svelte-modal-background { | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
background: rgba(0, 0, 0, 0.3); | ||
z-index: 2; | ||
} | ||
.svelte-modal { | ||
position: absolute; | ||
left: 50%; | ||
top: 50%; | ||
width: calc(100vw - 4em); | ||
max-width: 36em; | ||
max-height: calc(100% - 4em); | ||
overflow: auto; | ||
transform: translate(-50%, -50%); | ||
border-radius: 0.2em; | ||
background: white; | ||
z-index: 2; | ||
} | ||
.svelte-modal > * { | ||
padding: 1em; | ||
} | ||
.svelte-modal-header { | ||
border-bottom: 1px solid #e9ecef; | ||
align-items: center; | ||
} | ||
.svelte-modal-content { | ||
overflow-y: auto; | ||
max-height: 300px; | ||
} | ||
.svelte-modal-actions { | ||
border-top: 1px solid #e9ecef; | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: flex-end; | ||
align-items: center; | ||
} | ||
</style> | ||
</ModalFooter> | ||
</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
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