Update filter popover to modal

This commit is contained in:
Andrew Kingston 2021-04-26 16:14:16 +01:00
parent 37d1004d8d
commit 17bf73706a
3 changed files with 22 additions and 41 deletions

View File

@ -3,7 +3,7 @@
</script>
<label
class={`spectrum-FieldLabel spectrum-FieldLabel--sizeM spectrum-Form-itemLabel`}>
class={`spectrum-FieldLabel spectrum-FieldLabel--sizeL spectrum-Form-itemLabel`}>
<slot />
</label>

View File

@ -1,20 +1,21 @@
<script>
import { Popover, Button, Icon } from "@budibase/bbui"
import { Button, Modal } from "@budibase/bbui"
import FilterPopover from "../popovers/FilterPopover.svelte"
export let view = {}
let anchor
let dropdown
let modal
</script>
<div bind:this={anchor}>
<Button icon="Filter" primary size="S" quiet
on:click={dropdown.show}
active={view.filters && view.filters.length}>
<Button
icon="Filter"
primary
size="S"
quiet
on:click={modal.show}
active={view.filters?.length}>
Filter
</Button>
</div>
<Popover bind:this={dropdown} {anchor} align="left">
<FilterPopover {view} onClosed={dropdown.hide} />
</Popover>
<Modal bind:this={modal}>
<FilterPopover {view} />
</Modal>

View File

@ -1,5 +1,5 @@
<script>
import { Button, Select, Label, notifications } from "@budibase/bbui"
import { Select, Label, notifications, ModalContent } from "@budibase/bbui"
import { tables, views } from "stores/backend"
import analytics from "analytics"
@ -35,13 +35,15 @@
function saveView() {
views.save(view)
notifications.success(`View ${view.name} saved.`)
onClosed()
analytics.captureEvent("Added View Calculate", { field: view.field })
}
</script>
<div class="actions">
<h5>Calculate</h5>
<ModalContent
title="Calculate"
confirmText="Save"
onConfirm={saveView}
disabled={!view.field}>
<div class="input-group-row">
<Label>The</Label>
<Select
@ -54,31 +56,9 @@
<Select bind:value={view.field} options={fields} />
{/if}
</div>
<div class="footer">
<Button secondary on:click={onClosed}>Cancel</Button>
<Button cta on:click={saveView} disabled={!view.field}>Save</Button>
</div>
</div>
</ModalContent>
<style>
.actions {
width: 200px;
display: grid;
grid-gap: var(--spacing-xl);
padding: var(--spacing-xl);
}
h5 {
margin: 0;
font-weight: 500;
}
.footer {
display: flex;
justify-content: flex-end;
gap: var(--spacing-m);
}
.input-group-row {
display: grid;
grid-template-columns: auto 1fr;