Fix styling of label sidebar
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -1,34 +1,42 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<ul class="labels">
|
<ul class="labels">
|
||||||
<li v-for="label in labels" :key="label.id">
|
<li v-for="label in labels" :key="label.id" :class="{editing: (editingLabelId === label.id)}">
|
||||||
<template v-if="editingLabelId === label.id">
|
<template v-if="editingLabelId === label.id">
|
||||||
<input v-model="editingLabel.title">
|
<form class="label-form">
|
||||||
<compact-picker :value="editingLabel.color" :palette="defaultColors" @input="updateColor" />
|
<input v-model="editingLabel.title" type="text">
|
||||||
<button v-tooltip="{content: missingDataLabel, show: !editLabelObjValidated, trigger: 'manual' }" :disabled="!editLabelObjValidated" class="icon-checkmark"
|
<input v-tooltip="{content: missingDataLabel, show: !editLabelObjValidated, trigger: 'manual' }" :disabled="!editLabelObjValidated" type="submit"
|
||||||
@click="updateLabel(label)" />
|
value="" class="icon-confirm"
|
||||||
|
@click="updateLabel(label)">
|
||||||
<button v-tooltip="t('deck', 'Cancel')" class="icon-close" @click="editingLabelId = null" />
|
<input v-tooltip="t('deck', 'Cancel')" type="submit" value=""
|
||||||
|
class="icon-close" @click="editingLabelId = null">
|
||||||
|
</form>
|
||||||
|
<ColorPicker :value="'#' + editingLabel.color" @input="updateColor" />
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<span :style="{ backgroundColor: `#${label.color}`, color:textColor(label.color) }" class="label-title">
|
<div :style="{ backgroundColor: `#${label.color}`, color:textColor(label.color) }" class="label-title">
|
||||||
<span>{{ label.title }}</span>
|
<span>{{ label.title }}</span>
|
||||||
</span>
|
</div>
|
||||||
<button v-tooltip="t('deck', 'Edit')" class="icon-rename" @click="clickEdit(label)" />
|
<button v-tooltip="t('deck', 'Edit')" class="icon-rename" @click="clickEdit(label)" />
|
||||||
<button v-tooltip="t('deck', 'Delete')" class="icon-delete" @click="deleteLabel(label.id)" />
|
<button v-tooltip="t('deck', 'Delete')" class="icon-delete" @click="deleteLabel(label.id)" />
|
||||||
</template>
|
</template>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li v-if="addLabel">
|
<li v-if="addLabel" class="editing">
|
||||||
<template>
|
<template>
|
||||||
<input v-model="addLabelObj.title">
|
<form class="label-form">
|
||||||
<compact-picker :palette="defaultColors" value="" @input="updateColor" />
|
<input v-model="addLabelObj.title" type="text">
|
||||||
<button v-tooltip="{content: missingDataLabel, show: !addLabelObjValidated, trigger: 'manual' }" :disabled="!addLabelObjValidated" class="icon-checkmark"
|
<input v-tooltip="{content: missingDataLabel, show: !addLabelObjValidated, trigger: 'manual' }" :disabled="!addLabelObjValidated" type="submit"
|
||||||
@click="clickAddLabel()" />
|
value="" class="icon-confirm"
|
||||||
<button v-tooltip="t('deck', 'Cancel')" class="icon-close" @click="addLabel=false" />
|
@click="clickAddLabel()">
|
||||||
|
<input v-tooltip="t('deck', 'Cancel')" type="submit" value=""
|
||||||
|
class="icon-close" @click="addLabel=false">
|
||||||
|
</form>
|
||||||
|
<ColorPicker :value="'#' + addLabelObj.color" @input="updateColor" />
|
||||||
</template>
|
</template>
|
||||||
</li>
|
</li>
|
||||||
<button v-tooltip="t('deck', 'Add')" class="icon-add" @click="clickShowAddLabel()" />
|
<button @click="clickShowAddLabel()">
|
||||||
|
<span class="icon-add" />{{ t('deck', 'Add a new label') }}</button>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -38,10 +46,12 @@
|
|||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
import Color from '../../mixins/color'
|
import Color from '../../mixins/color'
|
||||||
import { Compact } from 'vue-color'
|
import { Compact } from 'vue-color'
|
||||||
|
import ColorPicker from '../ColorPicker'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TagsTabSidebard',
|
name: 'TagsTabSidebard',
|
||||||
components: {
|
components: {
|
||||||
|
ColorPicker,
|
||||||
'compact-picker': Compact
|
'compact-picker': Compact
|
||||||
},
|
},
|
||||||
mixins: [Color],
|
mixins: [Color],
|
||||||
@@ -103,7 +113,7 @@ export default {
|
|||||||
this.editingLabelId = null
|
this.editingLabelId = null
|
||||||
},
|
},
|
||||||
clickShowAddLabel() {
|
clickShowAddLabel() {
|
||||||
this.addLabelObj = { cardId: null, color: '000', title: '' }
|
this.addLabelObj = { cardId: null, color: '000000', title: '' }
|
||||||
this.addLabel = true
|
this.addLabel = true
|
||||||
},
|
},
|
||||||
clickAddLabel() {
|
clickAddLabel() {
|
||||||
@@ -114,3 +124,41 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.labels li {
|
||||||
|
margin-bottom: 3px;
|
||||||
|
|
||||||
|
.label-title {
|
||||||
|
flex-grow: 1;
|
||||||
|
border-radius: 3px;
|
||||||
|
padding: 4px;
|
||||||
|
}
|
||||||
|
&:not(.editing) button {
|
||||||
|
width: 40px;
|
||||||
|
height: 34px;
|
||||||
|
margin: 0;
|
||||||
|
margin-left: -3px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.labels li {
|
||||||
|
display: flex;
|
||||||
|
&.editing {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
form {
|
||||||
|
display: flex;
|
||||||
|
input[type=text] {
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
button,
|
||||||
|
input:not([type='text']):last-child {
|
||||||
|
border-bottom-right-radius: var(--border-radius);
|
||||||
|
border-top-right-radius: var(--border-radius);
|
||||||
|
border-bottom-left-radius: 0;
|
||||||
|
border-top-left-radius: 0;
|
||||||
|
margin-left: -1px;
|
||||||
|
width: 35px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user