Skip to content

Commit

Permalink
feat(posts): add tag clicking
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed May 23, 2023
1 parent 3e1f4c6 commit 481fcf3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion components/pages/posts/post/Post.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}
})
const emit = defineEmits(['clickTag'])
const emit = defineEmits(['click-tag'])
const userSettings = useUserSettings()
Expand Down Expand Up @@ -159,6 +159,7 @@
}"
class="focus-visible:focus-util group inline-flex items-center rounded-full px-2 py-1 ring-1 ring-inset ring-base-0/20"
type="button"
@click="emit('click-tag', tag.name)"
>
<span class="group-hover:hover-text-util text-xs font-medium">
{{ tag.name }}
Expand Down
12 changes: 12 additions & 0 deletions pages/posts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,18 @@
await router.push(generatePostsRoute(selectedBooru.value.domain, undefined, selectedTags.value))
}
async function onPostClickTag(tag: string) {
selectedTags.value = [new Tag({ name: tag })]
await refreshInitialPosts()
if (errorInitialPosts.value) {
return
}
await router.push(generatePostsRoute(selectedBooru.value.domain, undefined, selectedTags.value))
}
</script>

<template>
Expand Down

0 comments on commit 481fcf3

Please sign in to comment.