-
Notifications
You must be signed in to change notification settings - Fork 327
Expand file tree
/
Copy pathColorSelector.vue
More file actions
58 lines (56 loc) · 1.24 KB
/
ColorSelector.vue
File metadata and controls
58 lines (56 loc) · 1.24 KB
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
<!--
- SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<CardDetailEntry :label="t('deck', 'Assign a color to this card')" data-test="color-selector">
<SelectColor slot="icon" :size="20" />
<template>
<NcColorPicker v-model="color" clearable>
<button :style="{ backgroundColor: color }"
class="color0 icon-colorpicker"
:disabled="!canEdit"
data-cy-color-actions />
</NcColorPicker>
</template>
</CardDetailEntry>
</template>
<script>
import { defineComponent } from 'vue'
import { NcColorPicker } from '@nextcloud/vue'
import SelectColor from 'vue-material-design-icons/SelectColor.vue'
import CardDetailEntry from './CardDetailEntry.vue'
export default defineComponent({
name: 'ColorSelector',
components: {
NcColorPicker,
SelectColor,
CardDetailEntry,
},
props: {
card: {
type: Object,
default: null,
},
canEdit: {
type: Boolean,
default: false,
},
},
computed: {
color: {
get() {
return this.card.color ? '#' + this.card.color : ''
},
set(color) {
this.$emit('change', color ? color.substring(1) : null)
},
},
},
})
</script>
<style scoped lang="scss">
.color0 {
width: 100px;
}
</style>