feat: modal sizes & create user id dropdown

This commit is contained in:
Arman committed 2022-07-01 12:04:54 +02:00
1 parent 276c488533
commit 905f222414
8 files changed
+52 -19

No files matched your search

+6 -2
View File
@@ -3,7 +3,7 @@
import { fade, fly, type FadeParams, type FlyParams } from 'svelte/transition';
export let show = false;
export let size: 'small' | 'big' = null;
let browser = false;
//TODO: explore other solutions compatible with testing library
onMount(() => {
@@ -51,7 +51,11 @@
{#if show}
<div class="modal-curtain" data-curtain on:click={handleBLur} transition:fade={transitionFade}>
<section class="modal" transition:fly={transitionFly}>
<section
class:is-small={size === 'small'}
class:is-big={size === 'big'}
class="modal"
transition:fly={transitionFly}>
<header class="modal-header">
<h4 class="modal-title">
<slot name="header" />
@@ -39,7 +39,7 @@
</script>
<Form on:submit={update}>
<Modal bind:show={showModal}>
<Modal size="big" bind:show={showModal}>
<svelte:fragment slot="header">{provider.name} OAuth2 Settings</svelte:fragment>
<FormList>
<p>
@@ -39,7 +39,7 @@
</script>
<Form on:submit={update}>
<Modal bind:show={showModal}>
<Modal size="big" bind:show={showModal}>
<svelte:fragment slot="header">{provider.name} OAuth2 Settings</svelte:fragment>
<FormList>
<p>
@@ -27,7 +27,7 @@
</script>
<Form on:submit={create}>
<Modal bind:show={showCreate}>
<Modal size="big" bind:show={showCreate}>
<svelte:fragment slot="header">Create Team</svelte:fragment>
<FormList>
<InputText
@@ -1,5 +1,5 @@
<script lang="ts">
import { Modal } from '$lib/components';
import { Modal, Card } from '$lib/components';
import { Pill } from '$lib/elements/';
import {
Button,
@@ -17,7 +17,7 @@
const dispatch = createEventDispatcher();
let idModal = false;
let showDropdown = false;
let name: string, mail: string, pass: string, id: string;
const create = async () => {
@@ -36,7 +36,7 @@
</script>
<Form on:submit={create}>
<Modal bind:show={showCreate}>
<Modal size="big" bind:show={showCreate}>
<svelte:fragment slot="header">Create User</svelte:fragment>
<FormList>
<InputText
@@ -58,15 +58,44 @@
required={true}
bind:value={pass} />
<div>
<Pill button on:click={() => (idModal = !idModal)}
>User ID <i class="icon-pencil" /></Pill>
</div>
{#if idModal}
<div class="common-section">
<p>Enter a custom user ID. Leave blank for a randomly generated user ID.</p>
<InputText id="id" label="" placeholder="" bind:value={id} />
{#if !showDropdown}
<div>
<Pill button on:click={() => (showDropdown = !showDropdown)}
>User ID <i class="icon-pencil" /></Pill>
</div>
{:else}
<Card>
<header class="modal-header">
<h4 class="modal-title">User ID</h4>
<button
type="button"
class="x-button"
aria-label="Close Modal"
title="Close Modal"
on:click={() => (showDropdown = false)}>
<span class="icon-x" aria-hidden="true" />
</button>
</header>
<div class="modal-content">
<p>Enter a custom user ID. Leave blank for a randomly generated user ID.</p>
</div>
<div class="modal-footer">
<input
class="input-text"
type="text"
name="id"
id="id"
placeholder="Enter ID"
bind:value={id} />
<div class="u-flex u-gap-12">
<div class="icon-info u-block" />
<p>
Allowed characters: alphanumeric, hyphen, non-leading underscore,
period
</p>
</div>
</div>
</Card>
{/if}
</FormList>
<svelte:fragment slot="footer">
@@ -36,7 +36,7 @@
</script>
<Form on:submit={update}>
<Modal bind:show={showModal}>
<Modal size="big" bind:show={showModal}>
<svelte:fragment slot="header">{provider.name} OAuth2 Settings</svelte:fragment>
<FormList>
<p>
@@ -39,7 +39,7 @@
</script>
<Form on:submit={update}>
<Modal bind:show={showModal}>
<Modal size="big" bind:show={showModal}>
<svelte:fragment slot="header">{provider.name} OAuth2 Settings</svelte:fragment>
<FormList>
<p>
@@ -40,7 +40,7 @@
</script>
<Form on:submit={update}>
<Modal bind:show={showModal}>
<Modal size="big" bind:show={showModal}>
<svelte:fragment slot="header">{provider.name} OAuth2 Settings</svelte:fragment>
<FormList>
<p>