2020-01-29 21:37:25 +02:00
|
|
|
<template>
|
|
|
|
<button class="nrvgflfuaxwgkxoynpnumyookecqrrvh _button" @click="toggle">
|
|
|
|
<b>{{ value ? this.$t('_cw.hide') : this.$t('_cw.show') }}</b>
|
|
|
|
<span v-if="!value">{{ this.label }}</span>
|
|
|
|
</button>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
import { length } from 'stringz';
|
|
|
|
import { concat } from '../../prelude/array';
|
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
props: {
|
|
|
|
value: {
|
|
|
|
type: Boolean,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
note: {
|
|
|
|
type: Object,
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
label(): string {
|
|
|
|
return concat([
|
|
|
|
this.note.text ? [this.$t('_cw.chars', { count: length(this.note.text) })] : [],
|
|
|
|
this.note.files && this.note.files.length !== 0 ? [this.$t('_cw.files', { count: this.note.files.length }) ] : [],
|
2020-06-03 07:30:17 +03:00
|
|
|
this.note.poll != null ? [this.$t('poll')] : []
|
2020-01-29 21:37:25 +02:00
|
|
|
] as string[][]).join(' / ');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
length,
|
|
|
|
|
|
|
|
toggle() {
|
|
|
|
this.$emit('input', !this.value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.nrvgflfuaxwgkxoynpnumyookecqrrvh {
|
|
|
|
display: inline-block;
|
|
|
|
padding: 4px 8px;
|
|
|
|
font-size: 0.7em;
|
|
|
|
color: var(--cwFg);
|
|
|
|
background: var(--cwBg);
|
|
|
|
border-radius: 2px;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
background: var(--cwHoverBg);
|
|
|
|
}
|
|
|
|
|
|
|
|
> span {
|
|
|
|
margin-left: 4px;
|
|
|
|
|
|
|
|
&:before {
|
|
|
|
content: '(';
|
|
|
|
}
|
|
|
|
|
|
|
|
&:after {
|
|
|
|
content: ')';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|