Skip to content

Commit fdecec4

Browse files
FOUR-26661: Implement cases list compoment in the Application Dashboard
1 parent e9ec0b9 commit fdecec4

File tree

1 file changed

+24
-32
lines changed

1 file changed

+24
-32
lines changed
Lines changed: 24 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<template>
22
<div class="tw-flex tw-justify-left">
3-
<span
4-
:class="`tw-inline-flex tw-items-center tw-text-xs tw-border-1 tw-rounded-lg
3+
<span :class="`tw-inline-flex tw-items-center tw-text-xs tw-border-1 tw-rounded-lg
54
tw-bg-${color}-100 tw-px-2 tw-py-1 tw-text-${color}-500`">
65
{{ label }}
76
</span>
87
</div>
98
</template>
10-
<script>
11-
import { defineComponent, computed } from "vue";
9+
<script setup>
10+
import { computed } from "vue";
1211
import { t } from "i18next";
12+
import { get } from "lodash";
1313
14-
export const statuses = {
14+
const statuses = {
1515
DRAFT: {
1616
color: "red",
1717
label: `${t("Draft")}`,
@@ -46,34 +46,26 @@ export const statuses = {
4646
},
4747
};
4848
49-
export default defineComponent({
50-
props: {
51-
columns: {
52-
type: Array,
53-
default: () => [],
54-
},
55-
column: {
56-
type: Object,
57-
default: () => ({}),
58-
},
59-
row: {
60-
type: Object,
61-
default: () => ({}),
62-
},
49+
const props = defineProps({
50+
columns: {
51+
type: Array,
52+
default: () => [],
6353
},
64-
setup(props, { emit }) {
65-
const color = computed(() => (
66-
statuses[props.row[props.column.field]].color || statuses.IN_PROGRESS.color
67-
));
68-
69-
const label = computed(() => (
70-
statuses[props.row[props.column.field]].label || statuses.IN_PROGRESS.label
71-
));
72-
73-
return {
74-
color,
75-
label,
76-
};
54+
column: {
55+
type: Object,
56+
default: () => ({}),
57+
},
58+
row: {
59+
type: Object,
60+
default: () => ({}),
7761
},
7862
});
63+
64+
const color = computed(() => (
65+
statuses[get(props.row, props.column.field)].color || statuses.IN_PROGRESS.color
66+
));
67+
68+
const label = computed(() => (
69+
statuses[get(props.row, props.column.field)].label || statuses.IN_PROGRESS.label
70+
));
7971
</script>

0 commit comments

Comments
 (0)