-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
22 changed files
with
296 additions
and
138 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,24 @@ | ||
<template> | ||
<div class="badge-container"> | ||
<div | ||
v-for="tag in [...tags].sort((a, b) => a.name.localeCompare(b.name))" | ||
:key="tag.id" | ||
class="badge me-1" | ||
@click="searchWord(tag.name)" | ||
> | ||
{{ tag.name }} | ||
</div> | ||
</div> | ||
<md-chip-set> | ||
<md-suggestion-chip v-for="tag in sortedTags()" v-bind:key="tag" :label="tag" @click="searchWord(tag)"></md-suggestion-chip> | ||
</md-chip-set> | ||
</template> | ||
|
||
<style lang="scss"> | ||
.badge-container { | ||
padding: 0; | ||
margin: 0; | ||
.badge { | ||
background-color: $badge-background-color; | ||
color: $badge-text-color; | ||
cursor: pointer; | ||
} | ||
} | ||
</style> | ||
|
||
<script setup lang="ts"> | ||
import type { Tag } from "@fumix/fu-blog-common"; | ||
import type { PropType } from "vue"; | ||
import { useRouter } from "vue-router"; | ||
import "@material/web/chips/chip-set.js"; | ||
import "@material/web/chips/filter-chip.js"; | ||
import "@material/web/chips/suggestion-chip.js"; | ||
const router = useRouter(); | ||
const props = defineProps({ tags: { type: Array as PropType<Tag[]>, required: true } }); | ||
const props = defineProps({ tags: { type: Array as PropType<string[]>, required: true } }); | ||
const sortedTags = () => [...props.tags].sort((a, b) => a.localeCompare(b)); | ||
const searchWord = (word: string): void => { | ||
if (word) { | ||
router.push(`/posts/?search=${word}&operator=and`); | ||
router.push(`/posts/?search=${encodeURIComponent(word)}&operator=and`); | ||
} | ||
}; | ||
</script> |
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 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
Oops, something went wrong.