Skip to content

Commit

Permalink
fix svelte conditional slot element issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Eggrror404 committed Feb 21, 2024
1 parent 9a45bb8 commit 398f91a
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions src/routes/post/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,24 @@
{/each}
</div>

<!-- tags buttons for desktop, on the right -->
{#if data.tags.length > 0}
<div class="sticky top-20 hidden w-max max-w-xs space-y-2 p-4 lg:block" slot="right">
<p class="font-bold">{m.post_filter_tags()}</p>
<div class="flex flex-wrap gap-2">
{#each data.tags as tag}
{@const tagsParam = getTagsParam(tags, tag)}
<a
class="btn-accent whitespace-nowrap
<svelte:fragment slot="right">
<!-- tags buttons for desktop, on the right -->
{#if data.tags.length > 0}
<div class="sticky top-20 hidden w-max max-w-xs space-y-2 p-4 lg:block">
<p class="font-bold">{m.post_filter_tags()}</p>
<div class="flex flex-wrap gap-2">
{#each data.tags as tag}
{@const tagsParam = getTagsParam(tags, tag)}
<a
class="btn-accent whitespace-nowrap
{tags.includes(tag) ? '' : 'border-opacity-10 text-opacity-80'}"
href="{base}/post{tagsParam === '' ? '' : '?tags=' + tagsParam}"
>
#{tag}
</a>
{/each}
href="{base}/post{tagsParam === '' ? '' : '?tags=' + tagsParam}"
>
#{tag}
</a>
{/each}
</div>
</div>
</div>
{/if}
{/if}
</svelte:fragment>
</CenteredPage>

0 comments on commit 398f91a

Please sign in to comment.