Merge pull request #16092 from Budibase/BUDI-9294/icon-picker-to-ts
Icon picker to ts
This commit is contained in:
commit
64ba991188
|
@ -1,15 +1,13 @@
|
|||
<script>
|
||||
import { Icon, Modal } from "@budibase/bbui"
|
||||
<script lang="ts">
|
||||
import ChooseIconModal from "@/components/start/ChooseIconModal.svelte"
|
||||
import { Icon, Modal } from "@budibase/bbui"
|
||||
|
||||
export let name
|
||||
export let size = "M"
|
||||
export let app
|
||||
export let color
|
||||
export let autoSave = false
|
||||
export let disabled = false
|
||||
export let name: string
|
||||
export let size: "M" = "M"
|
||||
export let color: string
|
||||
export let disabled: boolean = false
|
||||
|
||||
let modal
|
||||
let modal: Modal
|
||||
</script>
|
||||
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
|
@ -28,7 +26,7 @@
|
|||
</div>
|
||||
|
||||
<Modal bind:this={modal}>
|
||||
<ChooseIconModal {name} {color} {app} {autoSave} on:change />
|
||||
<ChooseIconModal {name} {color} on:change />
|
||||
</Modal>
|
||||
|
||||
<style>
|
||||
|
|
|
@ -1,18 +1,9 @@
|
|||
<script>
|
||||
import {
|
||||
ModalContent,
|
||||
Icon,
|
||||
ColorPicker,
|
||||
Label,
|
||||
notifications,
|
||||
} from "@budibase/bbui"
|
||||
import { appsStore } from "@/stores/portal"
|
||||
<script lang="ts">
|
||||
import { ColorPicker, Icon, Label, ModalContent } from "@budibase/bbui"
|
||||
import { createEventDispatcher } from "svelte"
|
||||
|
||||
export let app
|
||||
export let name
|
||||
export let color
|
||||
export let autoSave = false
|
||||
export let name: string
|
||||
export let color: string
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
|
@ -44,17 +35,8 @@
|
|||
]
|
||||
|
||||
const save = async () => {
|
||||
if (!autoSave) {
|
||||
dispatch("change", { color, name })
|
||||
return
|
||||
}
|
||||
try {
|
||||
await appsStore.save(app.instance._id, {
|
||||
icon: { name, color },
|
||||
})
|
||||
} catch (error) {
|
||||
notifications.error("Error updating app")
|
||||
}
|
||||
dispatch("change", { color, name })
|
||||
return
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in New Issue