2018-09-13 04:01:50 -05:00
|
|
|
<template>
|
2018-12-07 19:36:26 -06:00
|
|
|
<button class="nrvgflfuaxwgkxoynpnumyookecqrrvh" @click="toggle">
|
|
|
|
<b>{{ value ? this.$t('hide') : this.$t('show') }}</b>
|
2018-12-27 04:58:57 -06:00
|
|
|
<span v-if="!value">{{ this.label }}</span>
|
2018-12-07 19:36:26 -06:00
|
|
|
</button>
|
2018-09-13 04:01:50 -05:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2018-11-08 12:44:35 -06:00
|
|
|
import i18n from '../../../i18n';
|
2018-12-07 19:36:26 -06:00
|
|
|
import { length } from 'stringz';
|
2018-12-27 04:58:57 -06:00
|
|
|
import { concat } from '../../../../../prelude/array';
|
2018-09-13 04:01:50 -05:00
|
|
|
|
|
|
|
export default Vue.extend({
|
2018-11-08 12:44:35 -06:00
|
|
|
i18n: i18n('common/views/components/cw-button.vue'),
|
2018-12-07 19:36:26 -06:00
|
|
|
|
2018-09-13 04:01:50 -05:00
|
|
|
props: {
|
|
|
|
value: {
|
|
|
|
type: Boolean,
|
|
|
|
required: true
|
2018-12-07 19:36:26 -06:00
|
|
|
},
|
|
|
|
note: {
|
|
|
|
type: Object,
|
|
|
|
required: true
|
2018-09-13 04:01:50 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2018-12-27 04:58:57 -06:00
|
|
|
computed: {
|
|
|
|
label(): string {
|
|
|
|
return concat([
|
|
|
|
this.note.text ? [this.$t('chars', { count: length(this.note.text) })] : [],
|
|
|
|
this.note.files && this.note.files.length !== 0 ? [this.$t('files', { count: this.note.files.length }) ] : [],
|
|
|
|
this.note.poll != null ? [this.$t('poll')] : []
|
|
|
|
] as string[][]).join(' / ');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2018-09-13 04:01:50 -05:00
|
|
|
methods: {
|
2018-12-07 19:36:26 -06:00
|
|
|
length,
|
|
|
|
|
2018-09-13 04:01:50 -05:00
|
|
|
toggle() {
|
|
|
|
this.$emit('input', !this.value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
2018-09-26 12:02:07 -05:00
|
|
|
.nrvgflfuaxwgkxoynpnumyookecqrrvh
|
2018-09-13 04:01:50 -05:00
|
|
|
display inline-block
|
|
|
|
padding 4px 8px
|
|
|
|
font-size 0.7em
|
2018-09-26 12:02:07 -05:00
|
|
|
color var(--cwButtonFg)
|
|
|
|
background var(--cwButtonBg)
|
2018-09-13 04:01:50 -05:00
|
|
|
border-radius 2px
|
|
|
|
cursor pointer
|
|
|
|
user-select none
|
|
|
|
|
|
|
|
&:hover
|
2018-09-26 12:02:07 -05:00
|
|
|
background var(--cwButtonHoverBg)
|
2018-09-13 04:01:50 -05:00
|
|
|
|
2018-12-07 19:36:26 -06:00
|
|
|
> span
|
|
|
|
margin-left 4px
|
|
|
|
|
|
|
|
&:before
|
|
|
|
content '('
|
|
|
|
&:after
|
|
|
|
content ')'
|
|
|
|
|
2018-09-13 04:01:50 -05:00
|
|
|
</style>
|