2020-01-29 20:37:25 +01:00
|
|
|
<template>
|
2023-02-24 02:14:43 +01:00
|
|
|
<button class="nrvgflfu _button" @click.stop="toggle">
|
2022-01-28 03:39:49 +01:00
|
|
|
<b>{{ modelValue ? i18n.ts._cw.hide : i18n.ts._cw.show }}</b>
|
2021-09-29 17:50:45 +02:00
|
|
|
<span v-if="!modelValue">{{ label }}</span>
|
2020-01-29 20:37:25 +01:00
|
|
|
</button>
|
|
|
|
</template>
|
|
|
|
|
2022-01-07 05:26:12 +01:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { computed } from 'vue';
|
2020-01-29 20:37:25 +01:00
|
|
|
import { length } from 'stringz';
|
2022-12-12 04:24:12 +01:00
|
|
|
import * as misskey from 'calckey-js';
|
2021-11-11 18:02:25 +01:00
|
|
|
import { concat } from '@/scripts/array';
|
2022-01-07 05:26:12 +01:00
|
|
|
import { i18n } from '@/i18n';
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
modelValue: boolean;
|
|
|
|
note: misskey.entities.Note;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
2022-05-26 15:53:09 +02:00
|
|
|
(ev: 'update:modelValue', v: boolean): void;
|
2022-01-07 05:26:12 +01:00
|
|
|
}>();
|
|
|
|
|
|
|
|
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 }) ] : [],
|
2022-01-28 03:39:49 +01:00
|
|
|
props.note.poll != null ? [i18n.ts.poll] : []
|
2022-01-07 05:26:12 +01:00
|
|
|
] as string[][]).join(' / ');
|
2020-01-29 20:37:25 +01:00
|
|
|
});
|
2022-01-07 05:26:12 +01:00
|
|
|
|
|
|
|
const toggle = () => {
|
|
|
|
emit('update:modelValue', !props.modelValue);
|
|
|
|
};
|
2020-01-29 20:37:25 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2020-10-17 13:12:00 +02:00
|
|
|
.nrvgflfu {
|
2023-02-25 07:15:42 +01:00
|
|
|
position: relative;
|
|
|
|
z-index: 2;
|
2020-01-29 20:37:25 +01:00
|
|
|
display: inline-block;
|
|
|
|
padding: 4px 8px;
|
2022-08-17 07:59:29 +02:00
|
|
|
font-size: 0.8em;
|
2020-01-29 20:37:25 +01:00
|
|
|
color: var(--cwFg);
|
|
|
|
background: var(--cwBg);
|
2022-08-17 07:59:29 +02:00
|
|
|
padding: 6px 10px;
|
|
|
|
width: 90%;
|
|
|
|
border-radius: 10px;
|
|
|
|
margin-top: 10px;
|
2022-08-17 08:43:24 +02:00
|
|
|
margin-bottom: 10px;
|
2022-08-17 07:47:18 +02:00
|
|
|
transition: background-color 0.25s ease-in-out;
|
2020-01-29 20:37:25 +01:00
|
|
|
|
|
|
|
&:hover {
|
2022-08-20 09:02:15 +02:00
|
|
|
background: var(--cwFg);
|
|
|
|
color: var(--cwBg);
|
2020-01-29 20:37:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
> span {
|
|
|
|
margin-left: 4px;
|
|
|
|
|
|
|
|
&:before {
|
|
|
|
content: '(';
|
|
|
|
}
|
|
|
|
|
|
|
|
&:after {
|
|
|
|
content: ')';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|