-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Rename tags to categories (#572)
* Update schema and data * Rename usage * Tweak result count and anchors
- Loading branch information
1 parent
236c736
commit 0359af5
Showing
18 changed files
with
653 additions
and
802 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<script lang="ts"> | ||
import { page } from '$app/stores'; | ||
import Icon from '$lib/components/Icon/index.svelte'; | ||
export let categories: string[]; | ||
export let selectedCategories: string[]; | ||
</script> | ||
|
||
<div class="flex flex-wrap items-center gap-2" data-sveltekit-noscroll> | ||
{#each selectedCategories as category} | ||
{@const newCategories = selectedCategories.filter((c) => c !== category)} | ||
{@const title = category.replaceAll('-', ' ')} | ||
{#if newCategories.length === 0} | ||
<a class="category active" href={$page.url.pathname}>{title}</a> | ||
{:else} | ||
<a | ||
class="category active" | ||
href={`${$page.url.pathname}?${newCategories.map((t) => `category=${t}`).join('&')}`} | ||
> | ||
{title} | ||
</a> | ||
{/if} | ||
{/each} | ||
|
||
{#each categories as category} | ||
{#if !selectedCategories.includes(category)} | ||
{@const newCategories = [...selectedCategories, category]} | ||
{@const title = category.replaceAll('-', ' ')} | ||
<a | ||
class="category" | ||
href={`${$page.url.pathname}?${newCategories.map((t) => `category=${t}`).join('&')}`} | ||
> | ||
{title} | ||
</a> | ||
{/if} | ||
{/each} | ||
|
||
{#if selectedCategories.length !== 0} | ||
<a href={$page.url.pathname}><Icon name="close" /></a> | ||
{/if} | ||
</div> | ||
|
||
<style> | ||
a { | ||
text-decoration: none; | ||
} | ||
.category { | ||
padding: 4px 12px; | ||
border: 1px solid var(--link-color); | ||
border-radius: 9999px; | ||
font-family: Overpass; | ||
font-style: normal; | ||
font-weight: normal; | ||
font-size: 14px; | ||
line-height: 150%; | ||
text-align: center; | ||
} | ||
.active { | ||
color: #ff3e01; | ||
background: #ffdbcf; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.