frontend: .......help........

This commit is contained in:
OleSTEEP 2025-10-13 16:59:16 +03:00
parent 831f3a5f98
commit ebb7edcc8b
4 changed files with 31 additions and 8 deletions

View file

@ -24,7 +24,7 @@
</div> </div>
<style> <style>
/* Вертикальный список */ /* Горизонтальный список */
:global(.horisontal-bar) { :global(.horisontal-bar) {
display: flex; display: flex;
overflow-x: scroll; overflow-x: scroll;

View file

@ -1,32 +1,52 @@
<script> <script>
import AddButton from "./add_button.svelte"; import AddButton from "./add_button.svelte";
let { direction = "horisontal", image = $bindable() } = $props(); let { direction = "horisontal" } = $props();
let images = $state();
let image = $state();
$effect(() => { $effect(() => {
console.log(image); if (images.length > 0) {
const reader = new FileReader();
reader.addEventListener("load", function () {
image.setAttribute("src", reader.result);
});
reader.readAsDataURL(images[0]);
}
}); });
</script> </script>
<div class="{direction} input image rounded"> <div class="{direction} input img-div rounded">
<AddButton type="image" bind:files={image}/> <AddButton type="image" bind:files={images}/>
<img bind:this={image} src="" alt="">
</div> </div>
<style> <style>
/* Вертикальное изображение */ /* Вертикальное изображение */
.vertical { .vertical {
aspect-ratio: 11 / 16; aspect-ratio: 11 / 16;
padding: 0;
} }
/* Горизонтальное изображение */ /* Горизонтальное изображение */
.horisontal { .horisontal {
aspect-ratio: 16 / 11; aspect-ratio: 16 / 11;
padding: 0;
} }
:global(.image) { :global(.img-div) {
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
align-content: center; align-content: center;
text-align: center; text-align: center;
width: 11rem; width: 11rem;
} }
:global(.img-div) img {
object-fit: cover;
width: 100%;
}
:global(.img-div) :global(.plus) {
z-index: 2;
}
</style> </style>

View file

@ -66,6 +66,9 @@ button {
.horisontal-bar * { .horisontal-bar * {
margin: 0; margin: 0;
margin-right: 0.5rem; margin-right: 0.5rem;
}
.horisontal-bar p {
align-content: center; align-content: center;
} }

View file

@ -16,7 +16,7 @@
color: black; color: black;
} }
.cover .image { .cover .img-div {
background-color: white; background-color: white;
} }
@ -43,7 +43,7 @@
color: white; color: white;
} }
.cover .image { .cover .img-div {
background-color: #131A22; background-color: #131A22;
} }