budibase/packages/builder/src/components/design/NavigationPanel/NewLayoutModal.svelte

23 lines
655 B
Svelte
Raw Normal View History

<script>
import { goto } from "@sveltech/routify"
2020-12-07 21:29:41 +01:00
import { notifier } from "builderStore/store/notifications"
import { store } from "builderStore"
import { Input, ModalContent } from "@budibase/bbui"
let name = ""
2020-12-07 21:29:41 +01:00
async function save() {
try {
const layout = await store.actions.layouts.save({ name })
$goto(`./${layout._id}`)
2020-12-07 21:29:41 +01:00
notifier.success(`Layout ${name} created successfully`)
} catch (err) {
notifier.danger(`Error creating layout ${name}.`)
}
}
</script>
<ModalContent title="Create Layout" confirmText="Create" onConfirm={save}>
<Input thin label="Name" bind:value={name} />
</ModalContent>