2026-09-01 23:55:01 +00:00
|
|
|
<script lang="ts">
|
|
|
|
|
import type {Snippet} from "svelte"
|
|
|
|
|
import Button from "@lib/components/Button.svelte"
|
|
|
|
|
import ImageInputModal from "@app/components/ImageInputModal.svelte"
|
|
|
|
|
import {pushModal} from "@app/modal"
|
|
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
onSelect: (image: File | string) => void
|
|
|
|
|
initialValue?: string
|
|
|
|
|
children?: Snippet
|
2026-09-26 08:12:13 +00:00
|
|
|
class?: string
|
|
|
|
|
"aria-label"?: string
|
2026-09-01 23:55:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const {onSelect, initialValue, children, ...props}: Props = $props()
|
|
|
|
|
|
|
|
|
|
const open = () => pushModal(ImageInputModal, {onSelect, initialValue}, {nested: true})
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<Button onclick={open} {...props}>
|
|
|
|
|
{@render children?.()}
|
|
|
|
|
</Button>
|