2023-07-27 07:31:52 +02:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2020-01-29 20:37:25 +01:00
|
|
|
<template>
|
2023-05-14 04:43:56 +02:00
|
|
|
<div class="cpjygsrt">
|
2020-01-29 20:37:25 +01:00
|
|
|
<header>
|
|
|
|
<div class="title"><slot name="header"></slot></div>
|
|
|
|
<div class="buttons">
|
|
|
|
<slot name="func"></slot>
|
2021-11-19 11:36:12 +01:00
|
|
|
<button v-if="removable" class="_button" @click="remove()">
|
2022-12-19 11:01:30 +01:00
|
|
|
<i class="ti ti-trash"></i>
|
2020-01-29 20:37:25 +01:00
|
|
|
</button>
|
|
|
|
<button v-if="draggable" class="drag-handle _button">
|
2022-12-19 11:01:30 +01:00
|
|
|
<i class="ti ti-menu-2"></i>
|
2020-01-29 20:37:25 +01:00
|
|
|
</button>
|
2021-11-19 11:36:12 +01:00
|
|
|
<button class="_button" @click="toggleContent(!showBody)">
|
2022-12-19 11:01:30 +01:00
|
|
|
<template v-if="showBody"><i class="ti ti-chevron-up"></i></template>
|
|
|
|
<template v-else><i class="ti ti-chevron-down"></i></template>
|
2020-01-29 20:37:25 +01:00
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</header>
|
2020-04-16 16:13:33 +02:00
|
|
|
<div v-show="showBody" class="body">
|
2020-01-29 20:37:25 +01:00
|
|
|
<slot></slot>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2023-05-14 04:43:56 +02:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { ref } from 'vue';
|
2023-09-19 09:37:43 +02:00
|
|
|
import { i18n } from '@/i18n.js';
|
2020-01-29 20:37:25 +01:00
|
|
|
|
2023-05-14 04:43:56 +02:00
|
|
|
const props = withDefaults(defineProps<{
|
|
|
|
expanded?: boolean;
|
|
|
|
removable?: boolean;
|
|
|
|
draggable?: boolean;
|
|
|
|
}>(), {
|
|
|
|
expanded: true,
|
|
|
|
removable: true,
|
2020-01-29 20:37:25 +01:00
|
|
|
});
|
2023-05-14 04:43:56 +02:00
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
(ev: 'toggle', show: boolean): void;
|
|
|
|
(ev: 'remove'): void;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const showBody = ref(props.expanded);
|
|
|
|
|
|
|
|
function toggleContent(show: boolean) {
|
|
|
|
showBody.value = show;
|
|
|
|
emit('toggle', show);
|
|
|
|
}
|
|
|
|
|
|
|
|
function remove() {
|
|
|
|
emit('remove');
|
|
|
|
}
|
2020-01-29 20:37:25 +01:00
|
|
|
</script>
|
|
|
|
|
2022-12-27 10:29:39 +01:00
|
|
|
<style lang="scss" scoped>
|
2020-01-29 20:37:25 +01:00
|
|
|
.cpjygsrt {
|
|
|
|
position: relative;
|
2021-03-02 14:57:16 +01:00
|
|
|
overflow: hidden;
|
2020-01-29 20:37:25 +01:00
|
|
|
background: var(--panel);
|
2020-07-04 20:49:58 +02:00
|
|
|
border: solid 2px var(--X12);
|
2022-12-24 03:57:06 +01:00
|
|
|
border-radius: 8px;
|
2020-01-29 20:37:25 +01:00
|
|
|
|
|
|
|
&:hover {
|
2020-07-04 20:49:58 +02:00
|
|
|
border: solid 2px var(--X13);
|
2020-01-29 20:37:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
&.warn {
|
|
|
|
border: solid 2px #dec44c;
|
|
|
|
}
|
|
|
|
|
|
|
|
&.error {
|
|
|
|
border: solid 2px #f00;
|
|
|
|
}
|
|
|
|
|
|
|
|
> header {
|
|
|
|
> .title {
|
|
|
|
z-index: 1;
|
|
|
|
margin: 0;
|
|
|
|
padding: 0 16px;
|
|
|
|
line-height: 42px;
|
|
|
|
font-size: 0.9em;
|
|
|
|
font-weight: bold;
|
|
|
|
box-shadow: 0 1px rgba(#000, 0.07);
|
|
|
|
|
2021-04-20 16:22:59 +02:00
|
|
|
> i {
|
2020-01-29 20:37:25 +01:00
|
|
|
margin-right: 6px;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:empty {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .buttons {
|
|
|
|
position: absolute;
|
|
|
|
z-index: 2;
|
|
|
|
top: 0;
|
|
|
|
right: 0;
|
|
|
|
|
|
|
|
> button {
|
|
|
|
padding: 0;
|
|
|
|
width: 42px;
|
|
|
|
font-size: 0.9em;
|
|
|
|
line-height: 42px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.drag-handle {
|
|
|
|
cursor: move;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-16 16:13:33 +02:00
|
|
|
> .body {
|
2020-10-17 13:12:00 +02:00
|
|
|
::v-deep(.juejbjww), ::v-deep(.eiipwacr) {
|
2020-04-16 16:13:33 +02:00
|
|
|
&:not(.inline):first-child {
|
|
|
|
margin-top: 28px;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:not(.inline):last-child {
|
|
|
|
margin-bottom: 20px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-01-29 20:37:25 +01:00
|
|
|
}
|
|
|
|
</style>
|