2022-11-25 12:57:02 +00:00
|
|
|
<script setup lang="ts">
|
2022-12-04 20:00:02 +00:00
|
|
|
const props = defineProps<{ enabled?: boolean; filter?: boolean }>()
|
2022-11-25 12:57:02 +00:00
|
|
|
|
2022-11-27 07:20:33 +00:00
|
|
|
const showContent = ref(!props.enabled)
|
|
|
|
const toggleContent = useToggle(showContent)
|
|
|
|
|
|
|
|
watchEffect(() => {
|
|
|
|
showContent.value = !props.enabled
|
|
|
|
})
|
2022-11-25 12:57:02 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2022-11-30 02:07:13 +00:00
|
|
|
<div v-if="enabled" flex flex-col items-start>
|
2022-12-09 21:19:26 +00:00
|
|
|
<div class="content-rich" px-4 pb-2 text-center text-secondary text-sm w-full border="~ base" border-0 border-b-dotted border-b-3 mt-2>
|
2022-11-30 02:07:13 +00:00
|
|
|
<slot name="spoiler" />
|
|
|
|
</div>
|
2022-12-09 21:19:26 +00:00
|
|
|
<div flex="~ gap-1 center" w-full mt="-3.5">
|
|
|
|
<button btn-text px-2 py-1 text-3 bg-base flex="~ center gap-2" :class="showContent ? '' : 'filter-saturate-0 hover:filter-saturate-100'" @click="toggleContent()">
|
2022-11-30 02:07:13 +00:00
|
|
|
<div v-if="showContent" i-ri:eye-line />
|
|
|
|
<div v-else i-ri:eye-close-line />
|
2022-12-04 20:00:02 +00:00
|
|
|
{{ showContent ? $t('status.spoiler_show_less') : $t(filter ? 'status.filter_show_anyway' : 'status.spoiler_show_more') }}
|
2022-11-30 02:07:13 +00:00
|
|
|
</button>
|
|
|
|
</div>
|
2022-11-25 12:57:02 +00:00
|
|
|
</div>
|
2022-11-27 07:20:33 +00:00
|
|
|
<slot v-if="!enabled || showContent" />
|
2022-11-25 12:57:02 +00:00
|
|
|
</template>
|