* initial commit federation * more federation * more federation * more federation * completes follow, accept, undo * add trail create activity * process trail create activity * more trail create activity * adds missing endpoints * adds update and delete activity * adds comment activities * adds activities back * adds summit logs activities * deletes follow counts table * fixes migrations * fixes migrations * fixes migrations * fixes migrations * adds remote profiles * ctd * ctd * we are getting closer... * adds public summit logs * fixes federated trails in lists * adds remote lists * adds list activites * fixes lists * adds notifications * adds iri redirect * fixes comments and summitlogs * fixes follows and profiles * adds asynchronous send * fixes list search * adds encryption key * bug fixes * fixes activity signing * removes custon activity object types * adds html editor * fixes html editor * fixes display issues on mastodon * adds federated sharing * finishes announcements * fixes small summit log issues * adds trail likes * finalizes likes * fixes images for komoot * add disable federation option * adds private profiles * updates docs * adds federated comments * adds trail and comments actvitiypub routes * adds mentions to editor * adds mentions to trails, comments, summit logs * updates theme * updates theme * update docs * update docs * updates docs * fixes various frontend problems * fixes activitypub follows api * updates docs * updates docs --------- Co-authored-by: Christian Beutel <>
68 lines
2.2 KiB
Svelte
68 lines
2.2 KiB
Svelte
<script lang="ts">
|
|
import { isURL } from "$lib/util/file_util";
|
|
import type { Snippet } from "svelte";
|
|
import type { SearchItem } from "./search.svelte";
|
|
import { _ } from "svelte-i18n";
|
|
interface Props {
|
|
id?: string;
|
|
items?: SearchItem[];
|
|
element?: HTMLUListElement;
|
|
onclick?: (e: Event, item: SearchItem) => void;
|
|
prepend?: Snippet<[any]>;
|
|
extraClasses?: string;
|
|
}
|
|
|
|
let {
|
|
id,
|
|
items = [],
|
|
element = $bindable(),
|
|
onclick,
|
|
prepend,
|
|
extraClasses,
|
|
}: Props = $props();
|
|
</script>
|
|
|
|
<ul
|
|
{id}
|
|
class="menu absolute bg-menu-background border border-input-border rounded-xl shadow-md overflow-x-hidden overflow-y-scroll max-h-72 {extraClasses}"
|
|
style="z-index: 1001"
|
|
>
|
|
{#if items.length == 0}
|
|
<li
|
|
class="menu-item flex items-center px-4 py-3 cursor-pointer hover:bg-menu-item-background-hover focus:bg-menu-item-background-focus transition-colors"
|
|
>
|
|
{$_("no-results")}
|
|
</li>
|
|
{/if}
|
|
{#each items as item}
|
|
<!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
|
|
<!-- svelte-ignore a11y_no_noninteractive_tabindex -->
|
|
<li
|
|
class="menu-item flex items-center px-4 py-3 cursor-pointer hover:bg-menu-item-background-hover focus:bg-menu-item-background-focus transition-colors"
|
|
tabindex="0"
|
|
onmousedown={(e) => onclick?.(e, item)}
|
|
onkeydown={(e) => onclick?.(e, item)}
|
|
>
|
|
{#if prepend}{@render prepend({ item })}
|
|
{:else if isURL(item.icon)}
|
|
<img
|
|
class="rounded-full w-8 mr-4 aspect-square"
|
|
src={item.icon}
|
|
alt="avatar"
|
|
/>
|
|
{:else}
|
|
<i class="fa fa-{item.icon} basis-8 shrink-0"></i>
|
|
{/if}
|
|
|
|
<div>
|
|
<p>{item.text}</p>
|
|
{#if item.description}
|
|
<p class="text-sm text-gray-500">
|
|
{item.description}
|
|
</p>
|
|
{/if}
|
|
</div>
|
|
</li>
|
|
{/each}
|
|
</ul>
|