2020-01-30 04:37:25 +09:00
|
|
|
<template>
|
2023-04-23 09:21:38 +09:00
|
|
|
<button
|
|
|
|
class="_button"
|
|
|
|
:class="{showLess: modelValue, fade: !modelValue}"
|
|
|
|
@click.stop="toggle"
|
|
|
|
>
|
|
|
|
<span>{{ modelValue ? i18n.ts._cw.hide : i18n.ts._cw.show }}
|
|
|
|
<span v-if="!modelValue">{{ label }}</span>
|
|
|
|
</span>
|
2023-04-08 09:01:42 +09:00
|
|
|
</button>
|
2023-04-23 09:21:38 +09:00
|
|
|
|
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] : [],
|
2023-04-23 09:21:38 +09:00
|
|
|
props.note.renote != null ? [i18n.ts.quoteAttached] : [],
|
|
|
|
] 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>
|
2023-04-23 09:21:38 +09:00
|
|
|
._button {
|
|
|
|
font-weight: 700;
|
2020-01-30 04:37:25 +09:00
|
|
|
> span {
|
2023-04-23 09:21:38 +09:00
|
|
|
background: var(--cwBg) !important;
|
|
|
|
color: var(--cwFg);
|
|
|
|
transition: background .2s, color .2s;
|
|
|
|
> span {
|
|
|
|
font-weight: 500;
|
|
|
|
&::before {
|
|
|
|
content: "("
|
|
|
|
}
|
|
|
|
&::after {
|
|
|
|
content: ")"
|
|
|
|
}
|
2020-01-30 04:37:25 +09:00
|
|
|
}
|
|
|
|
}
|
2023-04-23 09:21:38 +09:00
|
|
|
&:hover > span {
|
|
|
|
background: var(--cwFg) !important;
|
|
|
|
color: var(--cwBg) !important;
|
|
|
|
}
|
2020-01-30 04:37:25 +09:00
|
|
|
}
|
|
|
|
</style>
|