8855a5fffb
* components/abuse-report-window.vue * use <script setup> * ✌️ * components/analog-clock.vue * wip components/autocomplete.vue * ✌️ * ✌️ * fix * wip components/captcha.vue * clean up * components/channel-follow-button * components/channel-preview.vue * components/core-core.vue * components/code.vue * wip components/date-separated-list.vue * fix * fix autocomplete.vue * ✌️ * remove global property * use <script setup> * components/dialog.vue * clena up * fix dialog.vue * Resolve https://github.com/misskey-dev/misskey/pull/8121#discussion_r781250966
63 lines
1.3 KiB
Vue
63 lines
1.3 KiB
Vue
<template>
|
|
<button class="nrvgflfu _button" @click="toggle">
|
|
<b>{{ modelValue ? i18n.locale._cw.hide : i18n.locale._cw.show }}</b>
|
|
<span v-if="!modelValue">{{ label }}</span>
|
|
</button>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { computed } from 'vue';
|
|
import { length } from 'stringz';
|
|
import * as misskey from 'misskey-js';
|
|
import { concat } from '@/scripts/array';
|
|
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(' / ');
|
|
});
|
|
|
|
const toggle = () => {
|
|
emit('update:modelValue', !props.modelValue);
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.nrvgflfu {
|
|
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>
|