Update merged files to use spectrum
This commit is contained in:
parent
9c903feed0
commit
7fa700a537
|
@ -3,15 +3,18 @@
|
||||||
|
|
||||||
export let href = "#"
|
export let href = "#"
|
||||||
export let size = "M"
|
export let size = "M"
|
||||||
export let quiet = false;
|
export let quiet = false
|
||||||
export let primary = false;
|
export let primary = false
|
||||||
export let secondary = false;
|
export let secondary = false
|
||||||
export let overBackground = false
|
export let overBackground = false
|
||||||
|
export let target
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<a {href}
|
<a
|
||||||
|
{href}
|
||||||
|
{target}
|
||||||
class:spectrum-Link--primary={primary}
|
class:spectrum-Link--primary={primary}
|
||||||
class:spectrum-Link--secondary={secondary}
|
class:spectrum-Link--secondary={secondary}
|
||||||
class:spectrum-Link--overBackground={overBackground}
|
class:spectrum-Link--overBackground={overBackground}
|
||||||
class:spectrum-Link--quiet={quiet}
|
class:spectrum-Link--quiet={quiet}
|
||||||
class="spectrum-Link spectrum-Link--size{size}"><slot /></a>
|
class="spectrum-Link spectrum-Link--size{size}"><slot /></a>
|
||||||
|
|
|
@ -5,10 +5,11 @@
|
||||||
import { fade, fly } from "svelte/transition"
|
import { fade, fly } from "svelte/transition"
|
||||||
import Portal from "svelte-portal"
|
import Portal from "svelte-portal"
|
||||||
import Context from "../context"
|
import Context from "../context"
|
||||||
import clickOutside from "../Actions/click_outside"
|
|
||||||
|
export let fixed = false
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
let visible = false
|
let visible = !!fixed
|
||||||
$: dispatch(visible ? "show" : "hide")
|
$: dispatch(visible ? "show" : "hide")
|
||||||
|
|
||||||
export function show() {
|
export function show() {
|
||||||
|
@ -19,7 +20,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
export function hide() {
|
export function hide() {
|
||||||
if (!visible) {
|
if (!visible || fixed) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
visible = false
|
visible = false
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
import "@spectrum-css/dialog/dist/index-vars.css"
|
import "@spectrum-css/dialog/dist/index-vars.css"
|
||||||
import { getContext } from "svelte"
|
import { getContext } from "svelte"
|
||||||
import Button from "../Button/Button.svelte"
|
import Button from "../Button/Button.svelte"
|
||||||
import Heading from "../Typography/Heading.svelte"
|
|
||||||
import Divider from "../Divider/Divider.svelte"
|
import Divider from "../Divider/Divider.svelte"
|
||||||
import Icon from "../Icon/Icon.svelte"
|
import Icon from "../Icon/Icon.svelte"
|
||||||
import Context from "../context"
|
import Context from "../context"
|
||||||
|
@ -35,8 +34,7 @@
|
||||||
style="position: relative;"
|
style="position: relative;"
|
||||||
role="dialog"
|
role="dialog"
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
aria-modal="true"
|
aria-modal="true">
|
||||||
>
|
|
||||||
<div class="spectrum-Dialog-grid">
|
<div class="spectrum-Dialog-grid">
|
||||||
<h1 class="spectrum-Dialog-heading spectrum-Dialog-heading--noHeader">
|
<h1 class="spectrum-Dialog-heading spectrum-Dialog-heading--noHeader">
|
||||||
{title}
|
{title}
|
||||||
|
@ -49,8 +47,7 @@
|
||||||
</section>
|
</section>
|
||||||
{#if showCancelButton || showConfirmButton}
|
{#if showCancelButton || showConfirmButton}
|
||||||
<div
|
<div
|
||||||
class="spectrum-ButtonGroup spectrum-Dialog-buttonGroup spectrum-Dialog-buttonGroup--noFooter"
|
class="spectrum-ButtonGroup spectrum-Dialog-buttonGroup spectrum-Dialog-buttonGroup--noFooter">
|
||||||
>
|
|
||||||
<slot name="footer" />
|
<slot name="footer" />
|
||||||
{#if showCancelButton}
|
{#if showCancelButton}
|
||||||
<Button group secondary on:click={hide}>{cancelText}</Button>
|
<Button group secondary on:click={hide}>{cancelText}</Button>
|
||||||
|
@ -61,8 +58,7 @@
|
||||||
cta
|
cta
|
||||||
{...$$restProps}
|
{...$$restProps}
|
||||||
disabled={confirmDisabled}
|
disabled={confirmDisabled}
|
||||||
on:click={confirm}
|
on:click={confirm}>
|
||||||
>
|
|
||||||
{confirmText}
|
{confirmText}
|
||||||
</Button>
|
</Button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
<script>
|
<script>
|
||||||
import { Button, Label, Input, Spacer } from "@budibase/bbui"
|
import {
|
||||||
import { notifier } from "builderStore/store/notifications"
|
notifications,
|
||||||
|
Button,
|
||||||
|
Link,
|
||||||
|
Input,
|
||||||
|
Modal,
|
||||||
|
ModalContent,
|
||||||
|
} from "@budibase/bbui"
|
||||||
import { auth } from "stores/backend"
|
import { auth } from "stores/backend"
|
||||||
|
|
||||||
let username = ""
|
let username = ""
|
||||||
|
@ -12,39 +18,51 @@
|
||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
})
|
})
|
||||||
notifier.success("Logged in successfully.")
|
notifications.success("Logged in successfully.")
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
notifier.danger("Invalid credentials")
|
notifications.error("Invalid credentials")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createTestUser() {
|
async function createTestUser() {
|
||||||
try {
|
try {
|
||||||
await auth.firstUser()
|
await auth.firstUser()
|
||||||
notifier.success("Test user created")
|
notifications.success("Test user created")
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
notifier.danger("Could not create test user")
|
notifications.error("Could not create test user")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<form on:submit|preventDefault data-cy="login-form">
|
<Modal fixed>
|
||||||
<Spacer large />
|
<ModalContent
|
||||||
<Label small>Email</Label>
|
size="L"
|
||||||
<Input outline bind:value={username} />
|
title="Log In"
|
||||||
<Spacer large />
|
onConfirm={login}
|
||||||
<Label small>Password</Label>
|
confirmText="Log In"
|
||||||
<Input outline type="password" on:change bind:value={password} />
|
showCancelButton={false}
|
||||||
<Spacer large />
|
showCloseIcon={false}>
|
||||||
<Button primary on:click={login}>Login</Button>
|
<Input label="Email" bind:value={username} />
|
||||||
<a target="_blank" href="/api/admin/auth/google">Sign In With Google</a>
|
<Input label="Password" type="password" on:change bind:value={password} />
|
||||||
|
<div class="footer" slot="footer">
|
||||||
|
<Link target="_blank" href="/api/admin/auth/google">
|
||||||
|
Sign In With Google
|
||||||
|
</Link>
|
||||||
<Button secondary on:click={createTestUser}>Create Test User</Button>
|
<Button secondary on:click={createTestUser}>Create Test User</Button>
|
||||||
</form>
|
</div>
|
||||||
|
</ModalContent>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
form {
|
.footer {
|
||||||
width: 60%;
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: flex-end;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.footer :global(a) {
|
||||||
|
margin-right: var(--spectrum-global-dimension-static-size-200);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
{
|
{
|
||||||
roleId: string()
|
roleId: string()
|
||||||
.nullable()
|
.nullable()
|
||||||
.required("You need to select a role for your user"),
|
.required("You need to select a role for this app"),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -1,28 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { TextButton as Button, Modal } from "@budibase/bbui"
|
import { Button } from "@budibase/bbui"
|
||||||
import { auth } from "stores/backend"
|
import { auth } from "stores/backend"
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div>
|
<Button primary quiet text icon="LogOut" on:click={auth.logout}>Log Out</Button>
|
||||||
<Button text on:click={auth.logout}>
|
|
||||||
<i class="ri-logout-box-line" />
|
|
||||||
<p>Logout</p>
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
div i {
|
|
||||||
font-size: 26px;
|
|
||||||
color: var(--grey-7);
|
|
||||||
margin-left: 12px;
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div p {
|
|
||||||
font-family: var(--font-sans);
|
|
||||||
font-size: var(--font-size-s);
|
|
||||||
color: var(--ink);
|
|
||||||
font-weight: 400;
|
|
||||||
margin: 0 0 0 12px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
|
@ -105,4 +105,8 @@
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.nav-bottom :global(> *) {
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue