Browse Source

Update ArticleNav

master
Nuša Pukšič 11 months ago
parent
commit
86976c5bf8
  1. 31
      src/lib/components/util/ArticleNav.svelte
  2. 6
      src/routes/publication/+page.svelte

31
src/lib/components/util/ArticleNav.svelte

@ -5,24 +5,6 @@ @@ -5,24 +5,6 @@
import { publicationColumnVisibility } from "$lib/stores";
import InlineProfile from "$components/util/InlineProfile.svelte";
import type { NDKEvent } from "@nostr-dev-kit/ndk";
import { onMount } from 'svelte';
import { fade } from 'svelte/transition';
let scrollY = $state(0);
// Run this every time the scroll event happens
function updateScroll() {
scrollY = window.scrollY;
}
onMount(() => {
window.addEventListener('scroll', updateScroll);
updateScroll(); // Set initial value
return () => {
window.removeEventListener('scroll', updateScroll);
};
});
let {
rootId,
@ -51,10 +33,9 @@ @@ -51,10 +33,9 @@
</script>
<nav class="Navbar navbar-leather sticky top-[75px] w-full min-h-[70px] px-2 sm:px-4 py-2.5 z-10">
<div class="mx-auto flex flex-wrap justify-around space-x-2 container">
{#if scrollY < 100}
<div class="buttons" transition:fade={{ duration: 300 }}>
<nav class="Navbar navbar-leather flex sticky top-[76px] w-full min-h-[70px] px-2 sm:px-4 py-2.5 z-10">
<div class="mx-auto flex flex-wrap justify-around items-stretch space-x-2 container">
<div class="buttons hidden">
<Button class='btn-leather !w-auto hidden' outline={true} onclick={() => toggleColumn('details')} >
<EyeOutline class="!fill-none inline mr-1" /><span class="hidden sm:inline">Details</span>
</Button>
@ -72,10 +53,8 @@ @@ -72,10 +53,8 @@
<GlobeOutline class="!fill-none inline mr-1" /><span class="hidden sm:inline">Social</span>
</Button>
</div>
{:else if scrollY > 200 }
<div class="text max-w-full" transition:fade={{ duration: 300 }}>
<p class="line-ellipsis"><b>{title}</b><br><span>by <InlineProfile pubkey={pubkey} title={author} /></span></p>
<div class="flex text max-w-full items-center">
<p class="line-ellipsis"><b>{title}</b> <span>by <InlineProfile pubkey={pubkey} title={author} /></span></p>
</div>
{/if}
</div>
</nav>

6
src/routes/publication/+page.svelte

@ -46,14 +46,14 @@ @@ -46,14 +46,14 @@
<meta name="twitter:image" content="{image}" />
</svelte:head>
{#key data}
<ArticleNav publicationType={data.publicationType} rootId={data.parser.getRootIndexId()} indexEvent={data.indexEvent} />
{/key}
<main class="publication {data.publicationType}">
{#await data.waitable}
<TextPlaceholder divClass='skeleton-leather w-full' size="xxl" />
{:then}
{#key data}
<ArticleNav publicationType={data.publicationType} rootId={data.parser.getRootIndexId()} indexEvent={data.indexEvent} />
{/key}
<Publication
rootAddress={data.indexEvent.tagAddress()}
publicationType={data.publicationType}

Loading…
Cancel
Save