MapComplete/src/UI/BigComponents/CopyrightSingleIcon.svelte

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

46 lines
1.2 KiB
Svelte
Raw Normal View History

<script lang="ts">
import type SmallLicense from "../../Models/smallLicense"
import { Utils } from "../../Utils"
import { twJoin } from "tailwind-merge"
export let iconPath: string
export let license: SmallLicense
try {
iconPath = "." + new URL(iconPath).pathname
} catch (e) {
console.warn(e)
}
let sources = Utils.NoNull(Utils.NoEmpty(license?.sources))
function sourceName(lnk: string) {
try {
return new URL(lnk).hostname
} catch {
console.error("Not a valid URL:", lnk)
}
return lnk
}
</script>
{#if license != undefined && license.license.indexOf("trivial") < 0}
2024-08-09 16:55:08 +02:00
<div class="border-box m-2 flex flex-wrap border-b border-gray-300">
<img
class={twJoin(
2025-02-10 02:04:58 +01:00
"mb-2 mr-2 min-h-12 w-12",
2024-08-09 16:55:08 +02:00
license["mostly_white"] && "h-12 rounded-full bg-slate-400"
)}
src={iconPath}
/>
<div class="flex flex-col" style="width: calc(100% - 50px - 0.5em); min-width: 12rem;">
<div class="font-bold">
{license.authors.join("; ")}
</div>
{license.license}
{#each sources as source}
<a href={source} target="_blank">{sourceName(source)}</a>
{/each}
</div>
</div>
{/if}