misc: make posts clickable as blocks
This commit is contained in:
1 parent
30a205cdef
commit
162262d974
6 files changed
+24
-14
No files matched your search
@@ -44,13 +44,6 @@
|
|||||||
"vitest": "^1.0.0",
|
"vitest": "^1.0.0",
|
||||||
"workbox-window": "^7.0.0"
|
"workbox-window": "^7.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
|
||||||
"@dicebear/core": "^6.0.4",
|
|
||||||
"@dicebear/initials": "^6.0.4",
|
|
||||||
"@sveltejs/adapter-auto": "^3.2.1",
|
|
||||||
"markdown-it": "^13.0.1",
|
|
||||||
"mono-svelte": "latest"
|
|
||||||
},
|
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"@rollup/plugin-node-resolve": "^15.2.3",
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
||||||
"@sveltejs/kit": "^2.0.0"
|
"@sveltejs/kit": "^2.0.0"
|
||||||
|
|||||||
@@ -44,13 +44,22 @@
|
|||||||
$userSettings.posts.deduplicateEmbed &&
|
$userSettings.posts.deduplicateEmbed &&
|
||||||
post.post.embed_description == post.post.body &&
|
post.post.embed_description == post.post.body &&
|
||||||
view != 'compact'
|
view != 'compact'
|
||||||
|
|
||||||
|
function onClick(e: any) {
|
||||||
|
const event = e as MouseEvent
|
||||||
|
const parent = document.getElementById(post.post.id.toString())
|
||||||
|
|
||||||
|
if (event.target == parent) {
|
||||||
|
goto(postLink(post.post))
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||||
<Material
|
<Material
|
||||||
color={view != 'card' ? 'none' : 'distinct'}
|
color={view != 'card' ? 'none' : 'distinct'}
|
||||||
class="relative max-w-full min-w-0 w-full
|
class="relative max-w-full min-w-0 w-full group cursor-pointer
|
||||||
{view != 'card' ? 'bg-transparent !border-0' : 'p-5'} {view == 'compact'
|
{view != 'card' ? 'bg-transparent !border-0' : 'p-5'} {view == 'compact'
|
||||||
? 'py-4 list-type'
|
? 'py-4 list-type'
|
||||||
: view == 'list'
|
: view == 'list'
|
||||||
@@ -58,6 +67,9 @@
|
|||||||
: 'py-5 flex flex-col gap-2'} {$$props.class}"
|
: 'py-5 flex flex-col gap-2'} {$$props.class}"
|
||||||
id={post.post.id.toString()}
|
id={post.post.id.toString()}
|
||||||
padding="none"
|
padding="none"
|
||||||
|
on:click={(e) => {
|
||||||
|
onClick(e)
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<PostMeta
|
<PostMeta
|
||||||
community={hideCommunity ? undefined : post.community}
|
community={hideCommunity ? undefined : post.community}
|
||||||
@@ -120,6 +132,10 @@
|
|||||||
</Badge>
|
</Badge>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
<div
|
||||||
|
class="absolute overflow-hidden inset-y-0.5 -inset-x-4 sm:-inset-x-5 sm:rounded-xl bg-slate-100 dark:bg-zinc-900
|
||||||
|
opacity-0 group-hover:opacity-100 transition-all -z-10 no-list-margin"
|
||||||
|
/>
|
||||||
</Material>
|
</Material>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -31,7 +31,8 @@
|
|||||||
bg-gradient-to-b text-transparent from-slate-600 via-slate-600
|
bg-gradient-to-b text-transparent from-slate-600 via-slate-600
|
||||||
dark:from-zinc-400 dark:via-zinc-400 bg-clip-text z-0
|
dark:from-zinc-400 dark:via-zinc-400 bg-clip-text z-0
|
||||||
${view == 'list' ? `max-h-24` : 'max-h-48'}`
|
${view == 'list' ? `max-h-24` : 'max-h-48'}`
|
||||||
: 'text-slate-600 dark:text-zinc-400 max-h-full'} {$$props.class ?? ''}"
|
: 'text-slate-600 dark:text-zinc-400 max-h-full'} pointer-events-none {$$props.class ??
|
||||||
|
''}"
|
||||||
bind:this={element}
|
bind:this={element}
|
||||||
>
|
>
|
||||||
<Markdown inline={!expanded} source={body} />
|
<Markdown inline={!expanded} source={body} />
|
||||||
@@ -40,7 +41,7 @@ ${view == 'list' ? `max-h-24` : 'max-h-48'}`
|
|||||||
on:click={() => (expanded = !expanded)}
|
on:click={() => (expanded = !expanded)}
|
||||||
size="square-sm"
|
size="square-sm"
|
||||||
color="tertiary"
|
color="tertiary"
|
||||||
class="text-black dark:text-white absolute z-10 isolate drop-shadow-xl {expanded
|
class="text-black dark:text-white absolute z-10 isolate drop-shadow-xl pointer-events-auto {expanded
|
||||||
? 'bottom-6'
|
? 'bottom-6'
|
||||||
: 'bottom-16'} left-1/2 -translate-x-1/2"
|
: 'bottom-16'} left-1/2 -translate-x-1/2"
|
||||||
title="Expand"
|
title="Expand"
|
||||||
|
|||||||
@@ -164,8 +164,8 @@
|
|||||||
{#if title && id}
|
{#if title && id}
|
||||||
<a
|
<a
|
||||||
href="/post/{getInstance()}/{id}"
|
href="/post/{getInstance()}/{id}"
|
||||||
class="text-lg leading-6 w-full hover:underline hover:text-primary-900 hover:dark:text-primary-100
|
class="inline text-lg hover:underline
|
||||||
transition-colors
|
hover:text-primary-900 hover:dark:text-primary-100 transition-colors
|
||||||
{$userSettings.font == 'satoshi/nunito'
|
{$userSettings.font == 'satoshi/nunito'
|
||||||
? 'font-display font-semibold'
|
? 'font-display font-semibold'
|
||||||
: 'font-medium'}"
|
: 'font-medium'}"
|
||||||
@@ -173,7 +173,7 @@
|
|||||||
class:dark:text-zinc-400={$userSettings.markReadPosts && read}
|
class:dark:text-zinc-400={$userSettings.markReadPosts && read}
|
||||||
style="grid-area: title;"
|
style="grid-area: title;"
|
||||||
>
|
>
|
||||||
<Markdown source={title} inline noStyle></Markdown>
|
<Markdown source={title} inline noStyle class="leading-6"></Markdown>
|
||||||
</a>
|
</a>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,7 @@
|
|||||||
/>
|
/>
|
||||||
<slot
|
<slot
|
||||||
name="main"
|
name="main"
|
||||||
class="w-full bg-slate-25 dark:bg-zinc-925 justify-self-center shadow-sm
|
class="w-full bg-slate-25 dark:bg-zinc-925 justify-self-center shadow-sm z-0
|
||||||
{contentPadding}"
|
{contentPadding}"
|
||||||
style="grid-area: main"
|
style="grid-area: main"
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in new issue
Block a user