-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
ClientTile.svelte
89 lines (74 loc) · 2.45 KB
/
ClientTile.svelte
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<script>
import ExpandContainer from "$lib/ExpandContainer.svelte";
import Tooltip from "$lib/Tooltip.svelte";
import TabBar from "$lib/TabBar.svelte";
import {slide} from 'svelte/transition';
import ClientConfig from "./ClientConfig.svelte";
import ClientSecret from "./ClientSecret.svelte";
import ClientDelete from "./ClientDelete.svelte";
import ClientBranding from "./ClientBranding.svelte";
export let client = {};
export let onSave;
let isLoading = false;
let expandContainer;
const tabBarItems = [
'CONFIG',
'SECRET',
'BRANDING',
'DELETE',
];
let selected = tabBarItems[0];
const tabBarDur = 200;
const tabBarDly = tabBarDur / 2;
function onDelete() {
expandContainer = false;
onSave();
}
</script>
<ExpandContainer bind:show={expandContainer}>
<div class="header" slot="header">
<Tooltip text="Client ID">
<div class="data font-mono">
{client.id}
</div>
</Tooltip>
{#if client.name}
<Tooltip text="Client Name">
<div class="data">
{client.name}
</div>
</Tooltip>
{/if}
</div>
<div slot="body">
<TabBar labels={tabBarItems} bind:selected/>
{#if selected === 'CONFIG'}
<div in:slide|global={{ delay: tabBarDly, duration: tabBarDur }} out:slide|global={{ duration: tabBarDur }}>
<ClientConfig bind:client bind:onSave/>
</div>
{:else if selected === 'SECRET'}
<div in:slide|global={{ delay: tabBarDly, duration: tabBarDur }} out:slide|global={{ duration: tabBarDur }}>
<ClientSecret bind:client/>
</div>
{:else if selected === 'BRANDING'}
<div in:slide|global={{ delay: tabBarDly, duration: tabBarDur }} out:slide|global={{ duration: tabBarDur }}>
<ClientBranding bind:client/>
</div>
{:else if selected === 'DELETE'}
<div in:slide|global={{ delay: tabBarDly, duration: tabBarDur }} out:slide|global={{ duration: tabBarDur }}>
<ClientDelete bind:client onSave={onDelete}/>
</div>
{/if}
</div>
</ExpandContainer>
<style>
.data {
display: flex;
align-items: center;
margin: 3px 10px;
}
.header {
display: flex;
align-items: center;
}
</style>