feat: Add search function
This commit is contained in:
1 parent
91134d05e4
commit
1dd179d636
22 files changed
+455
-70
No files matched your search
@@ -16,7 +16,7 @@
|
||||
|
||||
<Card class="bg-white flex flex-col w-full p-5 gap-2.5">
|
||||
<div class="flex flex-row w-full gap-2.5">
|
||||
<div class="flex flex-col gap-2.5 grow">
|
||||
<div class="flex flex-col gap-1 grow">
|
||||
<PostMeta
|
||||
community={post.community}
|
||||
user={post.creator}
|
||||
@@ -38,23 +38,21 @@
|
||||
</div>
|
||||
{#if $userSettings.showCompactPosts && (post.post.thumbnail_url || isImage(post.post.url))}
|
||||
<div class="flex-none w-24 h-24">
|
||||
<a
|
||||
href="/post/{getInstance()}/{post.post.id}"
|
||||
>
|
||||
<a href="/post/{getInstance()}/{post.post.id}">
|
||||
{#if post.post.thumbnail_url}
|
||||
<!-- svelte-ignore a11y-missing-attribute -->
|
||||
<img
|
||||
src="{post.post.thumbnail_url}?thumbnail=256&format=webp"
|
||||
loading="lazy"
|
||||
class="object-cover bg-slate-100 rounded-md h-24 w-24 border border-slate-200 dark:border-zinc-700"
|
||||
/>
|
||||
<!-- svelte-ignore a11y-missing-attribute -->
|
||||
<img
|
||||
src="{post.post.thumbnail_url}?thumbnail=256&format=webp"
|
||||
loading="lazy"
|
||||
class="object-cover bg-slate-100 rounded-md h-24 w-24 border border-slate-200 dark:border-zinc-700"
|
||||
/>
|
||||
{:else}
|
||||
<!-- svelte-ignore a11y-missing-attribute -->
|
||||
<img
|
||||
src="{post.post.url}?thumbnail=256&format=webp"
|
||||
loading="lazy"
|
||||
class="object-cover bg-slate-100 rounded-md h-24 w-24 border border-slate-200 dark:border-zinc-700"
|
||||
/>
|
||||
<!-- svelte-ignore a11y-missing-attribute -->
|
||||
<img
|
||||
src="{post.post.url}?thumbnail=256&format=webp"
|
||||
loading="lazy"
|
||||
class="object-cover bg-slate-100 rounded-md h-24 w-24 border border-slate-200 dark:border-zinc-700"
|
||||
/>
|
||||
{/if}
|
||||
</a>
|
||||
</div>
|
||||
@@ -71,30 +69,30 @@
|
||||
{/if}
|
||||
{#if isImage(post.post.url)}
|
||||
<div class="self-start" class:blur-3xl={post.post.nsfw}>
|
||||
<picture
|
||||
class="rounded-md overflow-hidden max-h-[min(50vh,500px)] w-full max-w-full"
|
||||
>
|
||||
<source
|
||||
srcset="{post.post.url}?thumbnail=256&format=webp"
|
||||
media="(max-width: 256px)"
|
||||
/>
|
||||
<source
|
||||
srcset="{post.post.url}?thumbnail=512&format=webp"
|
||||
media="(max-width: 512px)"
|
||||
/>
|
||||
<source
|
||||
srcset="{post.post.url}?thumbnail=720&format=webp"
|
||||
media="(max-width: 720px)"
|
||||
/>
|
||||
<!-- svelte-ignore a11y-missing-attribute -->
|
||||
<img
|
||||
src="{post.post.url}?thumbnail=1024&format=webp"
|
||||
loading="lazy"
|
||||
class="object-cover bg-slate-100 rounded-md max-h-[50vh] w-full"
|
||||
width={512}
|
||||
height={300}
|
||||
/>
|
||||
</picture>
|
||||
<picture
|
||||
class="rounded-md overflow-hidden max-h-[min(50vh,500px)] w-full max-w-full"
|
||||
>
|
||||
<source
|
||||
srcset="{post.post.url}?thumbnail=256&format=webp"
|
||||
media="(max-width: 256px)"
|
||||
/>
|
||||
<source
|
||||
srcset="{post.post.url}?thumbnail=512&format=webp"
|
||||
media="(max-width: 512px)"
|
||||
/>
|
||||
<source
|
||||
srcset="{post.post.url}?thumbnail=720&format=webp"
|
||||
media="(max-width: 720px)"
|
||||
/>
|
||||
<!-- svelte-ignore a11y-missing-attribute -->
|
||||
<img
|
||||
src="{post.post.url}?thumbnail=1024&format=webp"
|
||||
loading="lazy"
|
||||
class="object-cover bg-slate-100 rounded-md max-h-[50vh] w-full"
|
||||
width={512}
|
||||
height={300}
|
||||
/>
|
||||
</picture>
|
||||
</div>
|
||||
{:else if post.post.thumbnail_url && post.post.url}
|
||||
<PostLink
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import CommunityLink from '$lib/components/community/CommunityLink.svelte'
|
||||
import CommunityLink from '$lib/components/lemmy/community/CommunityLink.svelte'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import Badge from '$lib/components/ui/Badge.svelte'
|
||||
import UserLink from '$lib/components/user/UserLink.svelte'
|
||||
@@ -8,12 +8,12 @@
|
||||
import { Bookmark, Icon, InformationCircle, Trash } from 'svelte-hero-icons'
|
||||
|
||||
export let community: Community
|
||||
export let user: Person
|
||||
export let user: Person | undefined = undefined
|
||||
export let published: Date
|
||||
|
||||
// Score
|
||||
export let upvotes: number
|
||||
export let downvotes: number
|
||||
export let upvotes: number | undefined = undefined
|
||||
export let downvotes: number | undefined = undefined
|
||||
|
||||
// Badges
|
||||
export let nsfw: boolean
|
||||
@@ -27,13 +27,17 @@
|
||||
<div class="flex flex-col text-xs">
|
||||
<CommunityLink {community} />
|
||||
<span class="text-slate-600 dark:text-zinc-400 flex flex-row gap-1">
|
||||
<UserLink {user} />
|
||||
<span>•</span>
|
||||
{#if user}
|
||||
<UserLink {user} />
|
||||
<span>•</span>
|
||||
{/if}
|
||||
<RelativeDate date={published} />
|
||||
<span>•</span>
|
||||
<span>
|
||||
{Math.floor((upvotes / (upvotes + downvotes || 1)) * 100)}%
|
||||
</span>
|
||||
{#if upvotes && downvotes}
|
||||
<span>•</span>
|
||||
<span>
|
||||
{Math.floor((upvotes / (upvotes + downvotes || 1)) * 100)}%
|
||||
</span>
|
||||
{/if}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in new issue
Block a user