feat: new link design

This commit is contained in:
Xyphyn committed 2023-08-17 15:47:09 -07:00
1 parent f3fc1adf90
commit c936e96f75
3 files changed
+29 -20

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "photon-lemmy",
"version": "0.9.4",
"version": "0.9.5",
"private": true,
"scripts": {
"dev": "vite dev",
+21 -7
View File
@@ -1,14 +1,28 @@
<script lang="ts">
export let href: string
export let highlight: boolean = false
export let nowrap: boolean = false
$: url = new URL(href)
</script>
<a
{href}
class="{highlight ? 'text-sky-500' : ''} hover:underline"
{...$$restProps}
>
<a {href} class="{highlight ? 'text-blue-500' : ''} hover:underline max-w-full">
<slot name="icon" />
<slot />
<slot>
<span
class="flex gap-0 {nowrap
? 'w-full whitespace-nowrap overflow-hidden text-ellipsis text-xs'
: ''} {$$props.class}"
>
<span class="opacity-90">
{url.protocol}//
</span>
<span class="font-bold">
{url.hostname}
</span>
<span class="opacity-90">
{url.pathname}
</span>
</span>
</slot>
</a>
+7 -12
View File
@@ -1,26 +1,21 @@
<script lang="ts">
import { Icon, Link } from 'svelte-hero-icons'
import Link from '$lib/components/input/Link.svelte'
import { Icon, Link as LinkIcon } from 'svelte-hero-icons'
export let url: string
export let thumbnail_url: string
export let nsfw: boolean = false
</script>
<a href={url} class="self-start relative group" class:blur-3xl={nsfw}>
<Link href={url} highlight nowrap />
<a href={url}>
<img
src={thumbnail_url}
class="rounded-md max-w-sm w-full h-auto aspect-video object-cover bg-slate-200 dark:bg-zinc-800"
class="rounded-md max-w-[300px] w-full h-auto aspect-video object-cover bg-slate-200 dark:bg-zinc-800"
width={600}
height={400}
alt=""
class:blur-3xl={nsfw}
/>
<span
class="w-full px-4 py-1.5 overflow-hidden whitespace-nowrap text-ellipsis
text-sm group-hover:underline bg-slate-100 border dark:border-zinc-700
dark:bg-zinc-800 absolute bottom-0 rounded-b-md flex flex-row gap-1
items-center h-9"
>
<Icon src={Link} width={16} mini class="" />
{new URL(url).hostname}
</span>
</a>