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