Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add title and description props and slots for Modal #498

Merged
merged 5 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/lib/components/eventModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,7 @@
}
</script>

<Modal bind:show onSubmit={create} size="big">
<svelte:fragment slot="header">Create event</svelte:fragment>
<Modal title="Create event" bind:show onSubmit={create} size="big">
<slot />
<div>
<p class="u-text">Choose a service</p>
Expand Down
12 changes: 11 additions & 1 deletion src/lib/components/modal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
export let onSubmit: (e: SubmitEvent) => Promise<void> | void = function () {
return;
};
export let title = '';
export let description = '';
let dialog: HTMLDialogElement;
let alert: HTMLElement;
Expand Down Expand Up @@ -102,8 +104,11 @@
<span class={`icon-${icon}`} aria-hidden="true" />
</div>
{/if}

<h4 class="modal-title heading-level-5">
<slot name="header" />
<slot name="title">
{title}
</slot>
</h4>
</div>
{#if closable}
Expand All @@ -122,6 +127,11 @@
</button>
{/if}
</div>
<p>
<slot name="description">
{description}
</slot>
</p>
</header>
<div class="modal-content">
{#if error}
Expand Down
3 changes: 1 addition & 2 deletions src/lib/components/permissions/custom.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
$: disabled = !value || $groups.has(value);
</script>

<Modal bind:show on:close={reset} onSubmit={create}>
<svelte:fragment slot="header">Custom permission</svelte:fragment>
<Modal title="Custom permission" bind:show on:close={reset} onSubmit={create}>
<p class="text">
Custom permissions allow you to grant access to specific users or teams using their ID and
role.
Expand Down
3 changes: 1 addition & 2 deletions src/lib/components/permissions/team.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@
}
</script>

<Modal bind:show onSubmit={create} on:close={reset} size="big">
<svelte:fragment slot="header">Select teams</svelte:fragment>
<Modal title="Select teams" bind:show onSubmit={create} on:close={reset} size="big">
<p class="text">
Grant access to any member of a specific team. To grant access to team members with specific
roles, you will need to set a <button
Expand Down
3 changes: 1 addition & 2 deletions src/lib/components/permissions/user.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@
}
</script>

<Modal bind:show onSubmit={create} on:close={reset} size="big">
<svelte:fragment slot="header">Select users</svelte:fragment>
<Modal title="Select users" bind:show onSubmit={create} on:close={reset} size="big">
<p class="text">Grant access to any authenticated or anonymous user.</p>
<InputSearch
autofocus
Expand Down
3 changes: 1 addition & 2 deletions src/lib/layout/wizardExitModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
}
</script>

<Modal bind:show onSubmit={handleSubmit} icon="exclamation" state="warning">
<svelte:fragment slot="header">Exit Process</svelte:fragment>
<Modal title="Exit Process" bind:show onSubmit={handleSubmit} icon="exclamation" state="warning">
<p>
Are you sure you want to exit from <slot />? All data will be deleted. This action is
irreversible.
Expand Down
2 changes: 1 addition & 1 deletion src/lib/pages/domains/delete.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
</script>

<Modal
title="Delete domain"
bind:show={showDelete}
onSubmit={deleteDomain}
icon="exclamation"
state="warning"
headerDivider={false}>
<svelte:fragment slot="header">Delete domain</svelte:fragment>
{#if selectedDomain}
<p data-private>
Are you sure you want to delete <b>{selectedDomain.domain}</b>? You will no longer be
Expand Down
2 changes: 1 addition & 1 deletion src/lib/pages/domains/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@

<Delete bind:showDelete bind:selectedDomain {dependency} />
<Modal bind:show={showRetry} headerDivider={false} bind:error={retryError} size="big">
<svelte:fragment slot="header">
<svelte:fragment slot="title">
Retry {$domain.status === 'unverfied' ? 'certificate generation' : 'verification'}
</svelte:fragment>
<Retry on:error={(e) => (retryError = e.detail)} />
Expand Down
3 changes: 1 addition & 2 deletions src/routes/card/[uid]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,7 @@
</div>
</div>

<Modal bind:show={showEmbedCode}>
<svelte:fragment slot="header">Get Embed Code</svelte:fragment>
<Modal title="Get Embed Code" bind:show={showEmbedCode}>
<div class="u-overflow-hidden">
<Code language="html" code={embedCode} noMargin />
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/routes/console/account/delete.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
</script>

<Modal
title="Delete account"
bind:show={showDelete}
onSubmit={deleteAccount}
icon="exclamation"
state="warning"
headerDivider={false}>
<svelte:fragment slot="header">Delete account</svelte:fragment>
<p>Are you sure you want to delete your account?</p>
<svelte:fragment slot="footer">
<Button text on:click={() => (showDelete = false)}>Cancel</Button>
Expand Down
3 changes: 1 addition & 2 deletions src/routes/console/createOrganization.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@
}
</script>

<Modal {error} onSubmit={create} size="big" bind:show>
<svelte:fragment slot="header">Create new organization</svelte:fragment>
<Modal title="Create new organization" {error} onSubmit={create} size="big" bind:show>
<FormList>
<InputText
id="organization-name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@
}
</script>

<Modal {error} size="big" bind:show={showCreate} onSubmit={create}>
<svelte:fragment slot="header">Invite Member</svelte:fragment>
<Modal title="Invite Member" {error} size="big" bind:show={showCreate} onSubmit={create}>
<FormList>
<InputEmail
required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@
}
</script>

<Modal {error} onSubmit={create} size="big" bind:show>
<svelte:fragment slot="header">Create project</svelte:fragment>
<Modal title="Create project" {error} onSubmit={create} size="big" bind:show>
<FormList>
<InputText id="name" label="Name" bind:value={name} required autofocus={true} />
{#if !showCustomId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
icon="exclamation"
state="warning"
headerDivider={false}>
<svelte:fragment slot="header">
<svelte:fragment slot="title">
{isUser ? 'Leave organization' : 'Delete member'}
</svelte:fragment>
<p data-private>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
</script>

<Modal
title="Delete organization"
onSubmit={deleteOrg}
bind:show={showDelete}
icon="exclamation"
state="warning"
headerDivider={false}>
<svelte:fragment slot="header">Delete organization</svelte:fragment>
<p>
Are you sure you want to delete <b>{$organization.name}</b>? All projects ({$organization.total})
and data associated with this organization will be deleted. This action is irreversible.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</script>

<Modal {error} onSubmit={update} size="big" show on:close>
<svelte:fragment slot="header">{provider.name} OAuth2 Settings</svelte:fragment>
<svelte:fragment slot="title">{provider.name} OAuth2 Settings</svelte:fragment>
<FormList>
<p>
To use {provider.name} authentication in your application, first fill in this form. For more
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</script>

<Modal {error} size="big" show onSubmit={update} on:close>
<svelte:fragment slot="header">{provider.name} OAuth2 Settings</svelte:fragment>
<svelte:fragment slot="title">{provider.name} OAuth2 Settings</svelte:fragment>
<FormList>
<p>
To use {provider.name} authentication in your application, first fill in this form. For more
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</script>

<Modal {error} size="big" show onSubmit={update} on:close>
<svelte:fragment slot="header">{provider.name} OAuth2 Settings</svelte:fragment>
<svelte:fragment slot="title">{provider.name} OAuth2 Settings</svelte:fragment>
<FormList>
<p>
To use {provider.name} authentication in your application, first fill in this form. For more
Expand Down
3 changes: 1 addition & 2 deletions src/routes/console/project-[project]/auth/createTeam.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
}
</script>

<Modal {error} size="big" bind:show={showCreate} onSubmit={create}>
<svelte:fragment slot="header">Create team</svelte:fragment>
<Modal title="Create team" {error} size="big" bind:show={showCreate} onSubmit={create}>
<FormList>
<InputText
id="name"
Expand Down
3 changes: 1 addition & 2 deletions src/routes/console/project-[project]/auth/createUser.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@
}
</script>

<Modal {error} size="big" bind:show={showCreate} onSubmit={create}>
<svelte:fragment slot="header">Create user</svelte:fragment>
<Modal title="Create user" {error} size="big" bind:show={showCreate} onSubmit={create}>
<FormList>
<InputText
id="name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
</script>

<Modal {error} size="big" show onSubmit={update} on:close>
<svelte:fragment slot="header">{provider.name} OAuth2 Settings</svelte:fragment>
<svelte:fragment slot="title">{provider.name} OAuth2 Settings</svelte:fragment>
<FormList>
<p>
To use {provider.name} authentication in your application, first fill in this form. For more
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</script>

<Modal {error} size="big" show onSubmit={update} on:close>
<svelte:fragment slot="header">{provider.name} OAuth2 Settings</svelte:fragment>
<svelte:fragment slot="title">{provider.name} OAuth2 Settings</svelte:fragment>
<FormList>
<p>
To use {provider.name} authentication in your application, first fill in this form. For more
Expand Down
2 changes: 1 addition & 1 deletion src/routes/console/project-[project]/auth/mainOAuth.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</script>

<Modal {error} size="big" show onSubmit={update} on:close>
<svelte:fragment slot="header">{provider.name} OAuth2 Settings</svelte:fragment>
<svelte:fragment slot="title">{provider.name} OAuth2 Settings</svelte:fragment>
<FormList>
<p>
To use {provider.name} authentication in your application, first fill in this form. For more
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</script>

<Modal {error} onSubmit={update} size="big" show on:close>
<svelte:fragment slot="header">{provider.name} OAuth2 Settings</svelte:fragment>
<svelte:fragment slot="title">{provider.name} OAuth2 Settings</svelte:fragment>
<FormList>
<p>
To use {provider.name} authentication in your application, first fill in this form. For more
Expand Down
2 changes: 1 addition & 1 deletion src/routes/console/project-[project]/auth/oidcOAuth.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
</script>

<Modal {error} onSubmit={update} size="big" show on:close>
<svelte:fragment slot="header">{provider.name} OAuth2 Settings</svelte:fragment>
<svelte:fragment slot="title">{provider.name} OAuth2 Settings</svelte:fragment>
<FormList>
<p>
To use {provider.name} authentication in your application, first fill in this form. For more
Expand Down
2 changes: 1 addition & 1 deletion src/routes/console/project-[project]/auth/oktaOAuth.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</script>

<Modal {error} onSubmit={update} size="big" show on:close>
<svelte:fragment slot="header">{provider.name} OAuth2 Settings</svelte:fragment>
<svelte:fragment slot="title">{provider.name} OAuth2 Settings</svelte:fragment>
<FormList>
<p>
To use {provider.name} authentication in your application, first fill in this form. For more
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@
}
</script>

<Modal {error} onSubmit={create} size="big" bind:show={showCreate}>
<svelte:fragment slot="header">Create membership</svelte:fragment>
<Modal title="Create membership" {error} onSubmit={create} size="big" bind:show={showCreate}>
<FormList>
<InputEmail
id="email"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@
</script>

<Modal
title="Delete Member"
bind:show={showDelete}
onSubmit={deleteMembership}
icon="exclamation"
state="warning"
headerDivider={false}>
<svelte:fragment slot="header">Delete Member</svelte:fragment>
<p data-private>
Are you sure you want to delete <b>{selectedMembership.userName}</b> from '{selectedMembership.teamName}'?
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
</script>

<Modal
title="Delete team"
bind:show={showDelete}
onSubmit={deleteTeam}
icon="exclamation"
state="warning"
headerDivider={false}>
<svelte:fragment slot="header">Delete team</svelte:fragment>
<p data-private>
Are you sure you want to delete <b>{team.name}</b>?
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
{error}
bind:show
headerDivider={false}>
<svelte:fragment slot="header">Reset Email Template?</svelte:fragment>
<svelte:fragment slot="title">Reset Email Template?</svelte:fragment>
<p class="text">
Are you sure you want to reset the email template?
<b>Default values will be set in all inputs.</b>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
{error}
bind:show
headerDivider={false}>
<svelte:fragment slot="header">Reset SMS Template?</svelte:fragment>
<svelte:fragment slot="title">Reset SMS Template?</svelte:fragment>
<p class="text">
Are you sure you want to reset the SMS template?
<b>Default values will be set in all inputs.</b>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
</script>

<Modal
title="Delete all sessions"
bind:show={showDeleteAll}
onSubmit={deleteAllSessions}
icon="exclamation"
state="warning"
headerDivider={false}>
<svelte:fragment slot="header">Delete all sessions</svelte:fragment>
<p data-private>
Are you sure you want to delete <b>all of {$user.name}'s sessions?</b>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
</script>

<Modal
title="Delete member"
bind:show={showDelete}
onSubmit={deleteMembership}
icon="exclamation"
state="warning"
headerDivider={false}>
<svelte:fragment slot="header">Delete member</svelte:fragment>
{#if selectedMembership}
<p data-private>
Are you sure you want to delete <b>{selectedMembership.userName}</b> from '{selectedMembership.teamName}'?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,12 @@
</script>

<Modal
title="Delete sessions"
bind:show={showDelete}
onSubmit={deleteSession}
icon="exclamation"
state="warning"
headerDivider={false}>
<svelte:fragment slot="header">Delete sessions</svelte:fragment>

<p>Are you sure you want to delete this session?</p>
<svelte:fragment slot="footer">
<Button text on:click={() => (showDelete = false)}>Cancel</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
</script>

<Modal
title="Delete user"
bind:show={showDelete}
onSubmit={deleteUser}
icon="exclamation"
state="warning"
headerDivider={false}>
<svelte:fragment slot="header">Delete user</svelte:fragment>
<p data-private>Are you sure you want to delete <b>{$user.name}</b> from '{$project.name}'?</p>
<svelte:fragment slot="footer">
<Button text on:click={() => (showDelete = false)}>Cancel</Button>
Expand Down
Loading