2020-01-29 21:37:25 +02:00
|
|
|
<template>
|
2020-10-17 14:12:00 +03:00
|
|
|
<button class="nrvgflfu _button" @click="toggle">
|
2021-09-29 18:50:45 +03:00
|
|
|
<b>{{ modelValue ? $ts._cw.hide : $ts._cw.show }}</b>
|
|
|
|
<span v-if="!modelValue">{{ label }}</span>
|
2020-01-29 21:37:25 +02:00
|
|
|
</button>
|
|
|
|
</template>
|
|
|
|
|
2022-01-07 06:26:12 +02:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { computed } from 'vue';
|
2020-01-29 21:37:25 +02:00
|
|
|
import { length } from 'stringz';
|
2022-01-07 06:26:12 +02:00
|
|
|
import * as misskey from 'misskey-js';
|
2021-11-11 19:02:25 +02:00
|
|
|
import { concat } from '@/scripts/array';
|
2022-01-07 06:26:12 +02:00
|
|
|
import { i18n } from '@/i18n';
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
modelValue: boolean;
|
|
|
|
note: misskey.entities.Note;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
(e: 'update:modelValue', v: boolean): void;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const label = computed(() => {
|
|
|
|
return concat([
|
|
|
|
props.note.text ? [i18n.t('_cw.chars', { count: length(props.note.text) })] : [],
|
|
|
|
props.note.files && props.note.files.length !== 0 ? [i18n.t('_cw.files', { count: props.note.files.length }) ] : [],
|
|
|
|
props.note.poll != null ? [i18n.locale.poll] : []
|
|
|
|
] as string[][]).join(' / ');
|
2020-01-29 21:37:25 +02:00
|
|
|
});
|
2022-01-07 06:26:12 +02:00
|
|
|
|
|
|
|
const toggle = () => {
|
|
|
|
emit('update:modelValue', !props.modelValue);
|
|
|
|
};
|
2020-01-29 21:37:25 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2020-10-17 14:12:00 +03:00
|
|
|
.nrvgflfu {
|
2020-01-29 21:37:25 +02:00
|
|
|
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>
|