recipes: compact tag/category pills with fluid scaling, add tag search
All checks were successful
CI / update (push) Successful in 8s

Shrink TagBall font/padding and TagCloud gap using clamp() for
fluid sizing across viewports. Add search input on the tags page
to filter through keywords.
This commit is contained in:
2026-02-17 13:01:08 +01:00
parent a074fdc7e3
commit 13fd2143d9
4 changed files with 39 additions and 7 deletions

View File

@@ -5,10 +5,10 @@ let { tag, ref } = $props<{ tag: string, ref: string }>();
a{ a{
background-color: var(--blue); background-color: var(--blue);
text-decoration: none; text-decoration: none;
padding: 2rem; padding: clamp(0.4rem, 0.8vw, 0.8rem) clamp(0.8rem, 1.5vw, 1.5rem);
border-radius: 1000000px; border-radius: 1000000px;
transition: var(--transition-fast); transition: var(--transition-fast);
font-size: 2rem; font-size: clamp(0.85rem, 1.8vw, 1.5rem);
color: white; color: white;
} }
a:hover{ a:hover{

View File

@@ -5,7 +5,7 @@ div{
flex-direction: row; flex-direction: row;
flex-wrap: wrap; flex-wrap: wrap;
margin-inline:auto; margin-inline:auto;
gap: 1rem; gap: clamp(0.4rem, 1vw, 1rem);
justify-content: space-evenly; justify-content: space-evenly;
} }
</style> </style>

View File

@@ -17,7 +17,7 @@
<style> <style>
h1 { h1 {
text-align: center; text-align: center;
font-size: 3rem; font-size: 1.5rem;
} }
</style> </style>
<h1>{labels.title}</h1> <h1>{labels.title}</h1>

View File

@@ -7,8 +7,16 @@
const isEnglish = $derived(data.lang === 'en'); const isEnglish = $derived(data.lang === 'en');
const labels = $derived({ const labels = $derived({
title: isEnglish ? 'Keywords' : 'Stichwörter', title: isEnglish ? 'Keywords' : 'Stichwörter',
siteTitle: isEnglish ? 'Bocken Recipes' : 'Bocken Rezepte' siteTitle: isEnglish ? 'Bocken Recipes' : 'Bocken Rezepte',
search: isEnglish ? 'Search tags...' : 'Tags suchen...'
}); });
let query = $state('');
const filteredTags = $derived(
query
? data.tags.filter(t => t.toLowerCase().includes(query.toLowerCase()))
: data.tags
);
</script> </script>
<svelte:head> <svelte:head>
@@ -16,14 +24,38 @@
</svelte:head> </svelte:head>
<style> <style>
h1 { h1 {
font-size: 3rem; font-size: 1.5rem;
text-align: center; text-align: center;
} }
.search-wrap {
max-width: 400px;
margin: 0 auto 1rem;
padding-inline: 1rem;
}
input {
width: 100%;
padding: 0.5rem 0.75rem;
border: 1px solid var(--nord4);
border-radius: var(--radius-pill, 999px);
font-size: 0.9rem;
background: var(--nord6, #eceff4);
color: var(--nord0);
}
@media (prefers-color-scheme: dark) {
input {
background: var(--nord1);
border-color: var(--nord3);
color: var(--nord6);
}
}
</style> </style>
<h1>{labels.title}</h1> <h1>{labels.title}</h1>
<div class="search-wrap">
<input type="search" placeholder={labels.search} bind:value={query} />
</div>
<section> <section>
<TagCloud> <TagCloud>
{#each data.tags as tag} {#each filteredTags as tag}
<TagBall {tag} ref="/{data.recipeLang}/tag"> <TagBall {tag} ref="/{data.recipeLang}/tag">
</TagBall> </TagBall>
{/each} {/each}