Work in progress, moving login form around a bit.

This commit is contained in:
mike12345567 2021-05-17 13:47:23 +01:00
parent 0234d11110
commit db87d1d621
3 changed files with 84 additions and 10 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -0,0 +1,41 @@
<script>
import { Link } from "@budibase/bbui"
import GoogleLogo from "/assets/google-logo.png"
</script>
<div class="outer">
<Link target="_blank" href="/api/admin/auth/google">
<div class="inner">
<img src={GoogleLogo} alt="google icon" />
<p>Sign in with Google</p>
</div>
</Link>
</div>
<style>
.inner {
display: flex;
flex-direction: row;
background-color: #4285f4;
border-radius: 3px;
padding-right: 12px;
}
.inner img {
width: 24px;
margin: 1px 14px 1px 1px;
border-radius: 2px;
background-color: #fff;
padding: 8px;
}
.inner p {
margin: 12px 0 0;
}
.outer :global(a) {
text-decoration: none;
font-weight: bold;
color: #fff;
}
</style>

View File

@ -2,11 +2,13 @@
import { goto } from "@roxi/routify" import { goto } from "@roxi/routify"
import { import {
notifications, notifications,
Link,
Input, Input,
Modal, Modal,
ModalContent, ModalContent,
Button,
Divider,
} from "@budibase/bbui" } from "@budibase/bbui"
import GoogleButton from "./GoogleButton.svelte"
import { auth } from "stores/backend" import { auth } from "stores/backend"
let username = "" let username = ""
@ -25,35 +27,66 @@
notifications.error("Invalid credentials") notifications.error("Invalid credentials")
} }
} }
async function forgot() {
}
</script> </script>
<Modal fixed> <Modal fixed>
<ModalContent <ModalContent
size="M" size="M"
title="Log In" title="Log In"
onConfirm={login}
confirmText="Log In"
showCancelButton={false} showCancelButton={false}
showConfirmButton={false}
showCloseIcon={false} showCloseIcon={false}
> >
<Input label="Email" bind:value={username} /> <Input label="Email" bind:value={username} />
<Input label="Password" type="password" on:change bind:value={password} /> <Input label="Password" type="password" on:change bind:value={password} />
<div class="footer" slot="footer"> <div class="login-buttons">
<Link target="_blank" href="/api/admin/auth/google"> <Button secondary on:click={forgot}>Forgot Password?</Button>
Sign In With Google <Button cta on:click={login}>Login</Button>
</Link> </div>
<div class="or-divide">
<Divider noGrid />
<div class="or-label">
OR
</div>
</div>
<div class="sso">
<GoogleButton />
</div> </div>
</ModalContent> </ModalContent>
</Modal> </Modal>
<style> <style>
.footer { .sso {
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
}
.login-buttons {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: flex-end; justify-content: flex-end;
align-items: center; align-items: center;
} }
.footer :global(a) { .login-buttons :global(>*:not(:last-child)) {
margin-right: var(--spectrum-global-dimension-static-size-200); margin-right: var(--spacing-xl);
}
.or-divide {
position: relative;
}
.or-label {
position: absolute;
top: calc(50% - 2px);
left: 50%;
transform: translateX(-50%) translateY(-50%);
background-color: var(--background);
padding: 0 var(--spacing-xl);
font-weight: 500;
font-size: var(--font-size-s);
color: var(--spectrum-global-color-gray-600);
} }
</style> </style>