Skip to content

Commit

Permalink
Merge pull request #618 from appwrite/feat-user-labels
Browse files Browse the repository at this point in the history
Update label and custom permission modals
  • Loading branch information
TorstenDittmann authored Nov 15, 2023
2 parents 8f7ce02 + 90bdf82 commit 8f7012d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/lib/components/modal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
</button>
{/if}
</div>
<p>
<p class="u-margin-block-start-4">
<slot name="description">
{description}
</slot>
Expand Down
33 changes: 18 additions & 15 deletions src/lib/components/permissions/custom.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { Button, FormList, Helper, InputText } from '$lib/elements/forms';
import { Button, FormItem, FormList, Helper, InputText } from '$lib/elements/forms';
import { createEventDispatcher } from 'svelte';
import { Modal } from '..';
import type { Writable } from 'svelte/store';
Expand All @@ -25,21 +25,24 @@
$: disabled = !value || $groups.has(value);
</script>

<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.
</p>
<Modal
title="Custom permission"
description="Custom permissions allow you to grant access to specific users or teams using their ID and
role."
bind:show
on:close={reset}
onSubmit={create}>
<FormList>
<InputText
showLabel={false}
id="custom-permission"
label="Custom permission"
placeholder="user:[USER_ID] or team:[TEAM_ID]/[ROLE]"
bind:value />
<Helper type="neutral">
A permission should be formatted as: user:[USER_ID] or team:[TEAM_ID]/[ROLE]¸
</Helper>
<FormItem>
<InputText
id="custom-permission"
label="Role"
placeholder="user:[USER_ID] or team:[TEAM_ID]/[ROLE]"
bind:value />
<Helper type="neutral">
A permission should be formatted as: user:[USER_ID] or team:[TEAM_ID]/[ROLE]¸
</Helper>
</FormItem>
</FormList>

<svelte:fragment slot="footer">
Expand Down
18 changes: 12 additions & 6 deletions src/lib/components/permissions/label.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { Button, FormList, Helper, InputText } from '$lib/elements/forms';
import { Button, FormItem, FormList, Helper, InputText } from '$lib/elements/forms';
import { createEventDispatcher } from 'svelte';
import { Modal } from '..';
import type { Writable } from 'svelte/store';
Expand Down Expand Up @@ -32,12 +32,18 @@
$: disabled = !value || $groups.has(value);
</script>

<Modal title="Label" bind:show on:close={reset} onSubmit={create}>
<p class="text">Labels allow you to grant access to users with the specfied label.</p>
<Modal
title="Label"
description="Labels allow you to grant access to users with the specfied label."
bind:show
on:close={reset}
onSubmit={create}>
<FormList>
<InputText showLabel={false} id="label" label="Label" placeholder="admin" bind:value />
<Helper type={isError ? 'warning' : 'neutral'}
>Only alphanumeric characters are allowed.</Helper>
<FormItem>
<InputText id="label" label="Label" placeholder="Enter label" bind:value />
<Helper type={isError ? 'warning' : 'neutral'}
>Only alphanumeric characters are allowed.</Helper>
</FormItem>
</FormList>

<svelte:fragment slot="footer">
Expand Down

0 comments on commit 8f7012d

Please sign in to comment.