1
0
Fork 0
mirror of synced 2024-07-11 17:26:01 +12:00

Update settings to use new modal

This commit is contained in:
Andrew Kingston 2020-10-02 12:22:49 +01:00
parent 7583dfc711
commit 1c86753d00
3 changed files with 23 additions and 66 deletions

View file

@ -1,31 +1,17 @@
<script> <script>
import Modal from "./Modal.svelte" import SettingsModal from "./SettingsModal.svelte"
import { SettingsIcon } from "components/common/Icons/" import { SettingsIcon } from "components/common/Icons/"
import { getContext } from "svelte" import { Modal } from "components/common/Modal"
import { isActive, goto, layout } from "@sveltech/routify"
// Handle create app modal let modal
const { open, close } = getContext("simple-modal")
const showSettingsModal = () => {
open(
Modal,
{
name: "Placeholder App Name",
description: "This is a hardcoded description that needs to change",
},
{
closeOnEsc: true,
styleContent: { padding: 0 },
closeOnOuterClick: true,
}
)
}
</script> </script>
<span class="topnavitemright settings" on:click={showSettingsModal}> <span class="topnavitemright settings" on:click={modal.show}>
<SettingsIcon /> <SettingsIcon />
</span> </span>
<Modal bind:this={modal} wide>
<SettingsModal />
</Modal>
<style> <style>
span:first-letter { span:first-letter {

View file

@ -1,13 +1,8 @@
<script> <script>
import { General, Users, DangerZone, APIKeys } from "./tabs" import { General, Users, DangerZone, APIKeys } from "./tabs"
import { Switcher } from "@budibase/bbui"
import { ModalTitle } from "components/common/Modal"
import { Input, TextArea, Button, Switcher } from "@budibase/bbui"
import { SettingsIcon, CloseIcon } from "components/common/Icons/"
import { getContext } from "svelte"
import { post } from "builderStore/api"
export let name = ""
export let description = ""
const tabs = [ const tabs = [
{ {
title: "General", title: "General",
@ -30,15 +25,16 @@
component: DangerZone, component: DangerZone,
}, },
] ]
let value = "GENERAL" let value = "GENERAL"
$: selectedTab = tabs.find(tab => tab.key === value).component $: selectedTab = tabs.find(tab => tab.key === value).component
function hide() {}
</script> </script>
<div class="container"> <div class="container">
<div class="heading"> <ModalTitle>Settings</ModalTitle>
<i class="ri-settings-2-fill" />
<h3>Settings</h3>
</div>
<Switcher headings={tabs} bind:value> <Switcher headings={tabs} bind:value>
<svelte:component this={selectedTab} /> <svelte:component this={selectedTab} />
</Switcher> </Switcher>
@ -46,7 +42,6 @@
<style> <style>
.container { .container {
padding: 30px;
display: grid; display: grid;
grid-gap: var(--spacing-xl); grid-gap: var(--spacing-xl);
} }
@ -54,21 +49,7 @@
/* Fix margin defined in BBUI as L rather than XL */ /* Fix margin defined in BBUI as L rather than XL */
margin-bottom: var(--spacing-xl); margin-bottom: var(--spacing-xl);
} }
.container :global(textarea) {
.heading { min-height: 60px;
display: flex;
flex-direction: row;
align-items: center;
}
.heading h3 {
font-size: var(--font-size-xl);
color: var(--ink);
font-weight: 600;
margin: 0;
}
.heading i {
margin-right: var(--spacing-m);
font-size: 28px;
color: var(--grey-6);
} }
</style> </style>

View file

@ -2,6 +2,7 @@
import { params, goto } from "@sveltech/routify" import { params, goto } from "@sveltech/routify"
import { Input, TextArea, Button, Body } from "@budibase/bbui" import { Input, TextArea, Button, Body } from "@budibase/bbui"
import { del } from "builderStore/api" import { del } from "builderStore/api"
import { ModalFooter } from "components/common/Modal"
let value = "" let value = ""
let loading = false let loading = false
@ -9,16 +10,9 @@
async function deleteApp() { async function deleteApp() {
loading = true loading = true
const id = $params.application const id = $params.application
const res = await del(`/api/${id}`) await del(`/api/${id}`)
const json = await res.json()
loading = false loading = false
if (res.ok) { $goto("/")
$goto("/")
return json
} else {
throw new Error(json)
}
} }
</script> </script>
@ -35,13 +29,12 @@
thin thin
disabled={loading} disabled={loading}
placeholder="" /> placeholder="" />
<Button <ModalFooter
disabled={value !== 'DELETE' || loading} disabled={value !== 'DELETE' || loading}
red red
wide showCancelButton={false}
on:click={deleteApp}> confirmText="Delete Entire App"
Delete Entire Web App onConfirm={deleteApp} />
</Button>
</div> </div>
<style> <style>
@ -53,7 +46,4 @@
line-height: 1.2; line-height: 1.2;
margin: 0; margin: 0;
} }
.background :global(button) {
max-width: 100%;
}
</style> </style>