added blog post tag filter buttons

This commit is contained in:
2026-03-31 14:48:38 +02:00
parent 6440a098bf
commit 9dcb9823a8
4 changed files with 58 additions and 15 deletions

View File

@@ -19,7 +19,7 @@
<p class="entry-description">{post.post.description}</p>
<div class="entry-tag-container">
{#each post.post.tags as tag}
<span>{tag}</span>
<span class="post-tag">{tag}</span>
{/each}
</div>
</div>
@@ -99,15 +99,4 @@
flex-direction: row;
flex-wrap: nowrap;
}
.entry-tag-container span {
font-family: var(--font-mono);
font-size: 0.8rem;
background-color: var(--color-background-highlight-alt);
margin: 0;
padding: 4px;
border-radius: 8px;
line-height: 1.0rem;
font-weight: 600;
}
</style>

View File

@@ -0,0 +1,20 @@
<script>
let { children } = $props();
</script>
{@render children()}
<style>
:global {
.post-tag {
font-family: var(--font-mono);
font-size: 0.8rem;
background-color: var(--color-background-highlight-alt);
margin: 0;
padding: 4px;
border-radius: 8px;
line-height: 1rem;
font-weight: 600;
}
}
</style>

View File

@@ -2,9 +2,13 @@
import Banner2 from "$lib/banner2.svelte";
import Content from "$lib/viewport/content.svelte";
// import Gallery, { type GalleryEntry } from "$lib/lists/gallery.svelte";
import { posts, type BlogPostLink } from "./posts";
import { BlogPostTag, posts, type BlogPostLink } from "./posts";
import BlogGallery from "$lib/lists/blog-gallery.svelte";
function selectFilter(tag: string) {
console.log(tag);
}
// let entries: GalleryEntry[] = posts.map(mapEntries);
// function mapEntries(entry: BlogPostLink, index: number): GalleryEntry {
@@ -34,5 +38,35 @@
banner="robert.webp"
bannerAlt="View at a tram bridge rising and then curving to the left." />
<!-- TODO descriptions on filter click -->
<div class="tag-filter-container">
{#each Object.values(BlogPostTag) as tag}
<button onclick={() => {
selectFilter(tag)
}} class="post-tag tag-filter">{tag}</button>
{/each}
</div>
<BlogGallery {posts} />
</Content>
<style>
.tag-filter-container {
display: flex;
gap: 12px;
margin-bottom: 8px;
}
.tag-filter {
width: fit-content;
font-size: 0.9rem;
color: var(--color-text);
padding: 8px;
border-radius: 12px;
cursor: pointer;
}
.tag-filter:hover {
background-color: aqua;
}
</style>

View File

@@ -26,8 +26,8 @@ export interface BlogPostLink {
export enum BlogPostTag {
ART = "art-stuff", // ramblings to do with art
DRAWING = "drawing", // self-explanatory
TECH_TIP = "tech-tip", // tech guides
META = "natconf-meta", // about the website itself
TECH_TIP = "tech-tip", // tech guides
}