/
CategoryListItem.vue
123 lines (118 loc) 路 2.87 KB
/
CategoryListItem.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<template>
<div>
<table>
<thead>
<tr>
<th scope="col">
{{ $t('HELP_CENTER.PORTAL.EDIT.CATEGORIES.TABLE.NAME') }}
</th>
<th scope="col">
{{ $t('HELP_CENTER.PORTAL.EDIT.CATEGORIES.TABLE.DESCRIPTION') }}
</th>
<th scope="col">
{{ $t('HELP_CENTER.PORTAL.EDIT.CATEGORIES.TABLE.LOCALE') }}
</th>
<th scope="col">
{{ $t('HELP_CENTER.PORTAL.EDIT.CATEGORIES.TABLE.ARTICLE_COUNT') }}
</th>
<th scope="col" />
</tr>
</thead>
<tr>
<td colspan="100%" class="horizontal-line" />
</tr>
<tbody>
<tr v-for="category in categories" :key="category.id">
<td>
<span>{{ category.name }}</span>
</td>
<td>
<span>{{ category.description }}</span>
</td>
<td>
<span>{{ category.locale }}</span>
</td>
<td>
<span>{{ category.meta.articles_count }}</span>
</td>
<td>
<woot-button
v-tooltip.top-end="
$t(
'HELP_CENTER.PORTAL.EDIT.CATEGORIES.TABLE.ACTION_BUTTON.EDIT'
)
"
size="tiny"
variant="smooth"
icon="edit"
color-scheme="secondary"
@click="editCategory(category)"
/>
<woot-button
v-tooltip.top-end="
$t(
'HELP_CENTER.PORTAL.EDIT.CATEGORIES.TABLE.ACTION_BUTTON.DELETE'
)
"
size="tiny"
variant="smooth"
icon="delete"
color-scheme="alert"
@click="deleteCategory(category.id)"
/>
</td>
</tr>
</tbody>
</table>
<p v-if="categories.length === 0" class="empty-text">
{{ $t('HELP_CENTER.PORTAL.EDIT.CATEGORIES.TABLE.EMPTY_TEXT') }}
</p>
</div>
</template>
<script>
export default {
props: {
categories: {
type: Array,
default: () => [],
},
},
methods: {
editCategory(category) {
this.$emit('edit', category);
},
deleteCategory(categoryId) {
this.$emit('delete', categoryId);
},
},
};
</script>
<style lang="scss" scoped>
table {
thead tr th {
font-size: var(--font-size-small);
font-weight: var(--font-weight-medium);
text-transform: none;
color: var(--s-600);
padding-left: 0;
padding-top: 0;
}
tbody tr {
border-bottom: 0;
td {
font-size: var(--font-size-small);
padding-left: 0;
}
}
}
.horizontal-line {
border-bottom: 1px solid var(--color-border);
}
.empty-text {
display: flex;
justify-content: center;
color: var(--s-500);
font-size: var(--font-size-default);
margin-top: var(--space-three);
}
</style>