You've already forked AstralRinth
forked from didirus/AstralRinth
Add Modal triggers
This commit is contained in:
@@ -65,7 +65,6 @@
|
|||||||
<style lang="postcss">
|
<style lang="postcss">
|
||||||
.button {
|
.button {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-start;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding: 0.5rem 1rem;
|
padding: 0.5rem 1rem;
|
||||||
@@ -73,7 +72,6 @@
|
|||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
position: relative;
|
position: relative;
|
||||||
white-space: nowrap;
|
|
||||||
line-height: 100%;
|
line-height: 100%;
|
||||||
|
|
||||||
color: var(--color-bg-contrast);
|
color: var(--color-bg-contrast);
|
||||||
|
|||||||
@@ -18,8 +18,14 @@
|
|||||||
function close() {
|
function close() {
|
||||||
open = false
|
open = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function trigger() {
|
||||||
|
open = !open
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<slot name="trigger" {trigger} />
|
||||||
|
|
||||||
{#if open}
|
{#if open}
|
||||||
<div
|
<div
|
||||||
class="modal-background"
|
class="modal-background"
|
||||||
@@ -130,6 +136,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -16,7 +16,9 @@
|
|||||||
let keyInput = ''
|
let keyInput = ''
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Modal title={$t(`modal.deletion.${type}.title`)} bind:open>
|
<Modal title={$t(`modal.deletion.${type}.title`)} bind:open let:trigger>
|
||||||
|
<slot slot="trigger" name="trigger" {trigger} />
|
||||||
|
|
||||||
{#if type === 'account' || 'project'}
|
{#if type === 'account' || 'project'}
|
||||||
<div class="important-banner">
|
<div class="important-banner">
|
||||||
<IconExclamation /><span>{$t('modal.deletion.generic.important')}</span>
|
<IconExclamation /><span>{$t('modal.deletion.generic.important')}</span>
|
||||||
@@ -29,6 +31,7 @@
|
|||||||
bind:value={keyInput}
|
bind:value={keyInput}
|
||||||
{id} />
|
{id} />
|
||||||
</Field>
|
</Field>
|
||||||
|
|
||||||
<Button color="danger" slot="button" disabled={key !== keyInput}>
|
<Button color="danger" slot="button" disabled={key !== keyInput}>
|
||||||
<IconTrash />
|
<IconTrash />
|
||||||
{$t(`modal.deletion.${type}.action`)}
|
{$t(`modal.deletion.${type}.action`)}
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
```svelte example raised
|
```svelte example raised
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Modal, Checkbox, Button } from 'omorphia'
|
import { Modal, Button } from 'omorphia'
|
||||||
import IconArrowRight from 'virtual:icons/heroicons-outline/arrow-right'
|
import IconArrowRight from 'virtual:icons/heroicons-outline/arrow-right'
|
||||||
|
|
||||||
let open = false
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Checkbox bind:checked={open}>Open modal</Checkbox>
|
<Modal title="Example modal" danger cancelButton let:trigger>
|
||||||
|
<Button on:click={trigger} slot="trigger">Open modal</Button>
|
||||||
|
|
||||||
<Modal title="Example modal" danger cancelButton bind:open>
|
|
||||||
<p>Secret message goes here!</p>
|
<p>Secret message goes here!</p>
|
||||||
<Button color="primary" slot="button"><IconArrowRight /> Continue</Button>
|
<Button color="primary" slot="button"><IconArrowRight /> Continue</Button>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|||||||
@@ -1,16 +1,9 @@
|
|||||||
```svelte example raised
|
```svelte example raised
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { ModalDeletion, Button } from 'omorphia'
|
import { ModalDeletion, Button } from 'omorphia'
|
||||||
|
|
||||||
let open = false
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Button
|
<ModalDeletion type="account" key="venashial" let:trigger>
|
||||||
color="danger"
|
<Button slot="trigger" color="danger" on:click={trigger}>Delete account</Button>
|
||||||
on:click={() => {
|
</ModalDeletion>
|
||||||
open = true
|
|
||||||
}}>
|
|
||||||
Delete account
|
|
||||||
</Button>
|
|
||||||
<ModalDeletion type="account" key="venashial" bind:open />
|
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user