duckylib 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/buttons/LoginButton.svelte +4 -5
- package/dist/components/buttons/LoginButton.svelte.d.ts +1 -0
- package/dist/components/buttons/UserToast.svelte +3 -2
- package/dist/components/buttons/UserToast.svelte.d.ts +1 -0
- package/dist/components/containers/navigation/Header.svelte +8 -4
- package/dist/components/containers/navigation/Header.svelte.d.ts +2 -0
- package/package.json +1 -1
|
@@ -4,16 +4,15 @@
|
|
|
4
4
|
interface LoginButtonProps {
|
|
5
5
|
label?: string;
|
|
6
6
|
withIcon?: boolean;
|
|
7
|
+
|
|
8
|
+
onlogin?: () => Promise<void>;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
|
-
let {label = "Log In", withIcon = true}: LoginButtonProps = $props();
|
|
11
|
+
let {label = "Log In", withIcon = true, onlogin}: LoginButtonProps = $props();
|
|
10
12
|
|
|
11
|
-
function login() {
|
|
12
|
-
console.log("login")
|
|
13
|
-
}
|
|
14
13
|
</script>
|
|
15
14
|
|
|
16
|
-
<button onclick={
|
|
15
|
+
<button onclick={async () => await onlogin}>
|
|
17
16
|
{#if withIcon}<Symbol name="account_circle" inheritColor={true} sizePx={20} hoverEffect={false} />{/if}
|
|
18
17
|
<p class="font-bold">{label}</p>
|
|
19
18
|
</button>
|
|
@@ -11,9 +11,10 @@
|
|
|
11
11
|
|
|
12
12
|
interface UserToastProps {
|
|
13
13
|
user: Auth.User;
|
|
14
|
+
onlogout?: () => Promise<void>;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
let { user }: UserToastProps = $props();
|
|
17
|
+
let { user, onlogout }: UserToastProps = $props();
|
|
17
18
|
|
|
18
19
|
let showContextMenu = $state(false);
|
|
19
20
|
|
|
@@ -69,7 +70,7 @@
|
|
|
69
70
|
<contextentry
|
|
70
71
|
data-disabled="false"
|
|
71
72
|
id="log-out"
|
|
72
|
-
onclick={(
|
|
73
|
+
onclick={async () => await onlogout}
|
|
73
74
|
>
|
|
74
75
|
<span class="material-symbols-outlined">logout</span>
|
|
75
76
|
<red>Log Out</red>
|
|
@@ -38,6 +38,8 @@
|
|
|
38
38
|
defaultNav?: boolean;
|
|
39
39
|
|
|
40
40
|
authFeatures?: boolean;
|
|
41
|
+
onlogin?: (() => Promise<void>) | null;
|
|
42
|
+
onlogout?: (() => Promise<void>) | null;
|
|
41
43
|
|
|
42
44
|
nav?: HeaderNavigation[];
|
|
43
45
|
}
|
|
@@ -68,6 +70,8 @@
|
|
|
68
70
|
label = "",
|
|
69
71
|
|
|
70
72
|
authFeatures = false,
|
|
73
|
+
onlogin = null,
|
|
74
|
+
onlogout = null,
|
|
71
75
|
|
|
72
76
|
nav = [],
|
|
73
77
|
}: HeaderProps = $props();
|
|
@@ -160,10 +164,10 @@
|
|
|
160
164
|
{#if authFeatures}
|
|
161
165
|
<Row widthPx="fit">
|
|
162
166
|
|
|
163
|
-
{#if user !== null}
|
|
164
|
-
<UserToast {user} />
|
|
165
|
-
{:else}
|
|
166
|
-
<LoginButton label="Log in to Join" />
|
|
167
|
+
{#if user !== null && onlogout}
|
|
168
|
+
<UserToast {user} {onlogout} />
|
|
169
|
+
{:else if onlogin}
|
|
170
|
+
<LoginButton {onlogin} label="Log in to Join" />
|
|
167
171
|
{/if}
|
|
168
172
|
</Row>
|
|
169
173
|
{/if}
|
|
@@ -22,6 +22,8 @@ interface HeaderProps {
|
|
|
22
22
|
searchQueryDataKey?: string;
|
|
23
23
|
defaultNav?: boolean;
|
|
24
24
|
authFeatures?: boolean;
|
|
25
|
+
onlogin?: (() => Promise<void>) | null;
|
|
26
|
+
onlogout?: (() => Promise<void>) | null;
|
|
25
27
|
nav?: HeaderNavigation[];
|
|
26
28
|
}
|
|
27
29
|
declare const Header: import("svelte").Component<HeaderProps, {}, "">;
|