frontend: image file picker
This commit is contained in:
parent
ac97e5b152
commit
831f3a5f98
2 changed files with 18 additions and 8 deletions
|
@ -1,8 +1,15 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
const { handler, size = 32 } = $props();
|
let { handler = () => {}, type = "button", files = $bindable() } = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<button class="plus round" style="height: {size}px;" onclick={handler}>+</button>
|
{#if type == "button"}
|
||||||
|
<button class="plus round" style="height: 32px;" onclick={handler}>+</button>
|
||||||
|
{:else if type == "image"}
|
||||||
|
<label for="img-upload" class="plus round" style="height: 48px; display: inline-block;">+</label>
|
||||||
|
<input id="img-upload" accept="image/png, image/jpeg" style="display: none" bind:files type="file"/>
|
||||||
|
{:else}
|
||||||
|
TODO
|
||||||
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
/* Кнопка "плюс" */
|
/* Кнопка "плюс" */
|
||||||
|
@ -11,6 +18,8 @@
|
||||||
aspect-ratio: 1 / 1;
|
aspect-ratio: 1 / 1;
|
||||||
font-size: x-large;
|
font-size: x-large;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
text-align: center;
|
||||||
|
align-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (prefers-color-scheme: light) {
|
@media (prefers-color-scheme: light) {
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
<script>
|
<script>
|
||||||
import AddButton from "./add_button.svelte";
|
import AddButton from "./add_button.svelte";
|
||||||
let { direction = "horisontal", input = true } = $props();
|
let { direction = "horisontal", image = $bindable() } = $props();
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
console.log(image);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="{direction} {input ? "input" : ""} image rounded">
|
<div class="{direction} input image rounded">
|
||||||
<AddButton size=48 handler={() => {
|
<AddButton type="image" bind:files={image}/>
|
||||||
// addImage(plus.id, this.id);
|
|
||||||
// document.getElementById("screenshots").appendChild(new HorisontalImage().html);
|
|
||||||
}}/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue