-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathProjectList.vue
46 lines (42 loc) · 1.15 KB
/
ProjectList.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<script setup lang="ts">
defineProps({
projects: {
type: Array,
required: true,
default: () => [],
},
})
const { t } = useI18n()
const { queryParams, pushQuery } = useQuery()
const filters = computed(() => {
const f = queryParams.value
if (Object.keys(f).includes('q')) {
delete f.q
}
return f
})
const onFilterRemoved = (query: string) => pushQuery(query, undefined)
</script>
<template>
<main class="relative mb-auto">
<div class="container py-6">
<div class="flex flex-row flex-wrap pb-6">
<TwDismissableBadge
v-for="(value, query) in filters"
:key="`${query}:${value}`"
v-bind="getRandomDismissableBadgeStyle()"
class="mr-2"
@removed="onFilterRemoved(query)"
>
{{ `${query}:${value}` }}
</TwDismissableBadge>
</div>
<div v-if="Array.isArray(projects) && projects.length > 0" class="grid grid-cols-1 xl:grid-cols-2 gap-1 -m-4">
<ProjectCard v-for="project of projects" :key="project.slug" :project="project" />
</div>
<p v-else class="pt-4">
{{ t('no_post') }}
</p>
</div>
</main>
</template>