1
0
mirror of https://github.com/hotomoe/hotomoe synced 2024-12-25 12:08:07 +09:00
hotomoe/src/client/app/common/views/components/cw-button.vue

64 lines
1.2 KiB
Vue
Raw Normal View History

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