feat: add Done component

This commit is contained in:
Dominik Pschenitschni 2021-09-21 11:29:40 +02:00
parent 89cd8eafc4
commit c6b24dd8f1
No known key found for this signature in database
GPG key ID: B257AC0149F43A77
5 changed files with 76 additions and 32 deletions

View file

@ -0,0 +1,55 @@
<template>
<div
v-if="isDone"
class="is-done"
:class="{ 'is-done--small': variant === variants.SMALL }"
>
{{ $t('task.attributes.done') }}
</div>
</template>
<script>
const VARIANTS = {
DEFAULT: 'default',
SMALL: 'small',
}
export default {
name: 'Done',
data() {
return {
variants: VARIANTS,
}
},
props: {
isDone: {
type: Boolean,
default: false,
},
variant: {
type: String,
default: VARIANTS.DEFAULT,
validator: (variant) => Object.values(VARIANTS).includes(variant),
},
},
}
</script>
<style lang="scss" scoped>
.is-done {
background: $green;
color: $white;
padding: .5rem;
font-weight: bold;
line-height: 1;
border-radius: 4px;
text-align: center;
}
.is-done--small {
padding: .2rem .3rem;
}
</style>

View file

@ -1,7 +1,7 @@
<template> <template>
<div class="heading"> <div class="heading">
<h1 class="title task-id">{{ textIdentifier }}</h1> <h1 class="title task-id">{{ textIdentifier }}</h1>
<div class="is-done" v-if="task.done">Done</div> <Done class="heading__done" :is-done="task.done" />
<h1 <h1
class="title input" class="title input"
:class="{'disabled': !canWrite}" :class="{'disabled': !canWrite}"
@ -28,8 +28,13 @@
<script> <script>
import {mapState} from 'vuex' import {mapState} from 'vuex'
import Done from '@/components/misc/Done.vue'
export default { export default {
name: 'heading', name: 'heading',
components: {
Done,
},
data() { data() {
return { return {
showSavedMessage: false, showSavedMessage: false,
@ -90,3 +95,8 @@ export default {
} }
</script> </script>
<style lang="scss" scoped>
.heading__done {
margin-left: .5rem;
}
</style>

View file

@ -12,7 +12,7 @@
class="task loader-container draggable" class="task loader-container draggable"
> >
<span class="task-id"> <span class="task-id">
<span class="is-done" v-if="task.done">Done</span> <Done class="kanban-card__done" :is-done="task.done" variant="small" />
<template v-if="task.identifier === ''"> <template v-if="task.identifier === ''">
#{{ task.index }} #{{ task.index }}
</template> </template>
@ -66,6 +66,7 @@
import {playPop} from '../../../helpers/playPop' import {playPop} from '../../../helpers/playPop'
import PriorityLabel from '../../../components/tasks/partials/priorityLabel' import PriorityLabel from '../../../components/tasks/partials/priorityLabel'
import User from '../../../components/misc/user' import User from '../../../components/misc/user'
import Done from '@/components/misc/Done.vue'
import Labels from '../../../components/tasks/partials/labels' import Labels from '../../../components/tasks/partials/labels'
import ChecklistSummary from './checklist-summary' import ChecklistSummary from './checklist-summary'
@ -73,6 +74,7 @@ export default {
name: 'kanban-card', name: 'kanban-card',
components: { components: {
ChecklistSummary, ChecklistSummary,
Done,
PriorityLabel, PriorityLabel,
User, User,
Labels, Labels,
@ -230,12 +232,6 @@ $task-background: $white;
display: flex; display: flex;
} }
.is-done {
font-size: .75rem;
padding: .2rem .3rem;
margin: 0 .25rem 0 0;
}
&.is-moving { &.is-moving {
opacity: .5; opacity: .5;
} }
@ -264,4 +260,8 @@ $task-background: $white;
} }
} }
} }
.kanban-card__done {
margin-right: .25rem;
}
</style> </style>

View file

@ -3,24 +3,6 @@
background: transparent; background: transparent;
} }
// FIXME: create <Done> component
// used in
// - heading.vue
// - kanban-card.vue
// - Kanban.vue
// - Table.vue
.is-done {
background: $green;
color: $white;
padding: .5rem;
font-size: 1rem;
margin-left: .5rem;
font-weight: bold;
line-height: 1;
border-radius: 4px;
text-align: center;
}
// FIXME: should be a prop of TaskDetailView.vue // FIXME: should be a prop of TaskDetailView.vue
.modal-container .task-view { .modal-container .task-view {
border-radius: $radius; border-radius: $radius;

View file

@ -134,7 +134,7 @@
</router-link> </router-link>
</td> </td>
<td v-if="activeColumns.done"> <td v-if="activeColumns.done">
<div class="is-done" v-if="t.done">Done</div> <Done :is-done="t.done" variant="small" />
</td> </td>
<td v-if="activeColumns.title"> <td v-if="activeColumns.title">
<router-link :to="{name: 'task.detail', params: { id: t.id }}">{{ t.title }}</router-link> <router-link :to="{name: 'task.detail', params: { id: t.id }}">{{ t.title }}</router-link>
@ -190,6 +190,7 @@
<script> <script>
import taskList from '../../../components/tasks/mixins/taskList' import taskList from '../../../components/tasks/mixins/taskList'
import Done from '@/components/misc/Done.vue'
import User from '../../../components/misc/user' import User from '../../../components/misc/user'
import PriorityLabel from '../../../components/tasks/partials/priorityLabel' import PriorityLabel from '../../../components/tasks/partials/priorityLabel'
import Labels from '../../../components/tasks/partials/labels' import Labels from '../../../components/tasks/partials/labels'
@ -203,6 +204,7 @@ import Pagination from '@/components/misc/pagination.vue'
export default { export default {
name: 'Table', name: 'Table',
components: { components: {
Done,
FilterPopup, FilterPopup,
Sort, Sort,
Fancycheckbox, Fancycheckbox,
@ -319,11 +321,6 @@ export default {
.user { .user {
margin: 0; margin: 0;
} }
.is-done {
font-size: .9rem;
margin: 0;
}
} }
} }
</style> </style>