Skip to content

Commit f86177f

Browse files
Gcolon021JamesPeck
authored andcommitted
Update login button appearance and add support for dynamic images (#245)
The style changes are temporary and will likely be reverted in the future. The ability to include images will be kept.
1 parent 8a73be0 commit f86177f

File tree

5 files changed

+112
-2
lines changed

5 files changed

+112
-2
lines changed
Loading

src/lib/components/LoginButton.svelte

+8
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
resetSearch();
1616
});
1717
};
18+
19+
let imageSrc: string | undefined = undefined;
20+
if (provider.imagesrc) {
21+
imageSrc = './' + provider.imagesrc;
22+
}
1823
</script>
1924

2025
<button
@@ -23,6 +28,9 @@
2328
class={$$props.class ?? 'btn variant-filled-primary m-1'}
2429
on:click={() => login(redirectTo, provider.type)}
2530
>
31+
{#if imageSrc}
32+
<img src={imageSrc} alt={provider.imageAlt} class="h-8 mr-2" />
33+
{/if}
2634
{buttonText}
2735
</button>
2836

src/lib/models/AuthProvider.ts

+6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ export interface AuthData extends Indexable {
99
helpText?: string;
1010
enabled: boolean;
1111
alt: boolean;
12+
imageSrc?: string;
13+
imageAlt?: string;
1214
}
1315

1416
export default class AuthProvider implements AuthData {
@@ -21,6 +23,8 @@ export default class AuthProvider implements AuthData {
2123
logouturl?: string | undefined;
2224
callbackurl?: string | undefined;
2325
alt: boolean;
26+
imageSrc?: string | undefined;
27+
imageAlt?: string | undefined;
2428

2529
constructor(data: AuthData) {
2630
this.name = data.name;
@@ -29,6 +33,8 @@ export default class AuthProvider implements AuthData {
2933
this.icon = data.icon;
3034
this.enabled = data.enabled;
3135
this.alt = data.alt || false;
36+
this.imageSrc = data.imagesrc;
37+
this.imageAlt = data.imagealt;
3238
}
3339

3440
protected getRedirectURI(): string {

src/routes/(authentication)/login/+page.svelte

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
provider={selectedProvider}
6969
{redirectTo}
7070
helpText={selectedProvider.helptext}
71-
class="btn variant-filled-primary m-1 mt-2 w-full"
71+
class="btn variant-outline-primary m-1 mt-2 w-full"
7272
/>
7373
{/if}
7474
{:else}
@@ -78,7 +78,7 @@
7878
{provider}
7979
{redirectTo}
8080
helpText={provider.helptext}
81-
class="btn variant-filled-primary w-full"
81+
class="btn variant-outline-primary text-primary-500 w-full"
8282
/>
8383
{/each}
8484
{/if}
Loading

0 commit comments

Comments
 (0)