UX: improve styling of image attribution

This commit is contained in:
Pieter Vander Vennet 2023-12-16 01:39:10 +01:00
parent 7a3cb9fbdd
commit 2580a67e1f
4 changed files with 51 additions and 23 deletions

View file

@ -729,6 +729,14 @@ video {
bottom: 0px; bottom: 0px;
} }
.top-1\/2 {
top: 50%;
}
.left-1\/2 {
left: 50%;
}
.right-4 { .right-4 {
right: 1rem; right: 1rem;
} }
@ -1114,6 +1122,14 @@ video {
height: 4rem; height: 4rem;
} }
.h-0 {
height: 0px;
}
.h-5 {
height: 1.25rem;
}
.h-4 { .h-4 {
height: 1rem; height: 1rem;
} }
@ -1134,10 +1150,6 @@ video {
height: 2.75rem; height: 2.75rem;
} }
.h-5 {
height: 1.25rem;
}
.h-48 { .h-48 {
height: 12rem; height: 12rem;
} }
@ -1224,14 +1236,18 @@ video {
width: 6rem; width: 6rem;
} }
.w-4 {
width: 1rem;
}
.w-0 { .w-0 {
width: 0px; width: 0px;
} }
.w-5 {
width: 1.25rem;
}
.w-4 {
width: 1rem;
}
.w-3 { .w-3 {
width: 0.75rem; width: 0.75rem;
} }
@ -1256,10 +1272,6 @@ video {
width: auto; width: auto;
} }
.w-5 {
width: 1.25rem;
}
.w-10 { .w-10 {
width: 2.5rem; width: 2.5rem;
} }
@ -1733,6 +1745,11 @@ video {
background-color: rgb(255 255 255 / var(--tw-bg-opacity)); background-color: rgb(255 255 255 / var(--tw-bg-opacity));
} }
.bg-red-500 {
--tw-bg-opacity: 1;
background-color: rgb(239 68 68 / var(--tw-bg-opacity));
}
.bg-white\/50 { .bg-white\/50 {
background-color: rgb(255 255 255 / 0.5); background-color: rgb(255 255 255 / 0.5);
} }
@ -1782,14 +1799,14 @@ video {
padding: 0.25rem; padding: 0.25rem;
} }
.p-0 {
padding: 0px;
}
.p-0\.5 { .p-0\.5 {
padding: 0.125rem; padding: 0.125rem;
} }
.p-0 {
padding: 0px;
}
.p-12 { .p-12 {
padding: 3rem; padding: 3rem;
} }

View file

@ -5,6 +5,7 @@
import ImageAttribution from "./ImageAttribution.svelte" import ImageAttribution from "./ImageAttribution.svelte"
import type { ProvidedImage } from "../../Logic/ImageProviders/ImageProvider" import type { ProvidedImage } from "../../Logic/ImageProviders/ImageProvider"
import { Mapillary } from "../../Logic/ImageProviders/Mapillary" import { Mapillary } from "../../Logic/ImageProviders/Mapillary"
import { UIEventSource } from "../../Logic/UIEventSource"
export let image: ProvidedImage export let image: ProvidedImage
let fallbackImage: string = undefined let fallbackImage: string = undefined
@ -14,11 +15,14 @@
let imgEl: HTMLImageElement let imgEl: HTMLImageElement
export let imgClass: string = undefined export let imgClass: string = undefined
export let previewedImage: UIEventSource<string> = undefined
</script> </script>
<div class="relative"> <div class="relative">
<img bind:this={imgEl} src={image.url} class={imgClass ?? ""} on:error={(event) => { <img bind:this={imgEl} src={image.url} class={imgClass ?? ""}
on:click={() => {previewedImage?.setData(image)}}
on:error={(event) => {
if(fallbackImage){ if(fallbackImage){
imgEl.src = fallbackImage imgEl.src = fallbackImage
} }

View file

@ -34,7 +34,7 @@
{#if $license.artist} {#if $license.artist}
<div class="font-bold"> <div class="font-bold">
{$license.artist} {@html $license.artist}
</div> </div>
{/if} {/if}

View file

@ -14,17 +14,25 @@ import AttributedImage from "./AttributedImage.svelte"
export class ImageCarousel extends Toggle { export class ImageCarousel extends Toggle {
constructor( constructor(
images: Store<{ id:string, key: string; url: string; provider: ImageProvider }[]>, images: Store<{ id: string; key: string; url: string; provider: ImageProvider }[]>,
tags: Store<any>, tags: Store<any>,
state: { osmConnection?: OsmConnection; changes?: Changes; layout: LayoutConfig, previewedImage?: UIEventSource<ProvidedImage> }, state: {
osmConnection?: OsmConnection
changes?: Changes
layout: LayoutConfig
previewedImage?: UIEventSource<ProvidedImage>
},
feature: Feature feature: Feature
) { ) {
const uiElements = images.map( const uiElements = images.map(
(imageURLS: { key: string; url: string; provider: ImageProvider, id: string }[]) => { (imageURLS: { key: string; url: string; provider: ImageProvider; id: string }[]) => {
const uiElements: BaseUIElement[] = [] const uiElements: BaseUIElement[] = []
for (const url of imageURLS) { for (const url of imageURLS) {
try { try {
let image: BaseUIElement = new SvelteUIElement(AttributedImage, {image: url}) let image: BaseUIElement = new SvelteUIElement(AttributedImage, {
image: url,
previewedImage: state.previewedImage,
})
if (url.key !== undefined) { if (url.key !== undefined) {
image = new Combine([ image = new Combine([
@ -37,7 +45,6 @@ export class ImageCarousel extends Toggle {
image image
.SetClass("w-full block") .SetClass("w-full block")
.SetStyle("min-width: 50px; background: grey;") .SetStyle("min-width: 50px; background: grey;")
.onClick(() => state.previewedImage.setData(url))
uiElements.push(image) uiElements.push(image)
} catch (e) { } catch (e) {
console.error("Could not generate image element for", url.url, "due to", e) console.error("Could not generate image element for", url.url, "due to", e)