2023-07-27 05:31:52 +00:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2020-01-29 19:37:25 +00:00
|
|
|
<template>
|
2023-05-14 02:43:56 +00:00
|
|
|
<div class="cpjygsrt">
|
2020-01-29 19:37:25 +00:00
|
|
|
<header>
|
|
|
|
<div class="title"><slot name="header"></slot></div>
|
|
|
|
<div class="buttons">
|
|
|
|
<slot name="func"></slot>
|
2021-11-19 10:36:12 +00:00
|
|
|
<button v-if="removable" class="_button" @click="remove()">
|
2023-09-30 19:53:52 +00:00
|
|
|
<i class="ph-trash ph-bold ph-lg"></i>
|
2020-01-29 19:37:25 +00:00
|
|
|
</button>
|
|
|
|
<button v-if="draggable" class="drag-handle _button">
|
2023-09-30 22:46:42 +00:00
|
|
|
<i class="ph-list ph-bold ph-lg-2"></i>
|
2020-01-29 19:37:25 +00:00
|
|
|
</button>
|
2021-11-19 10:36:12 +00:00
|
|
|
<button class="_button" @click="toggleContent(!showBody)">
|
2023-09-30 19:53:52 +00:00
|
|
|
<template v-if="showBody"><i class="ph-caret-up ph-bold ph-lg"></i></template>
|
|
|
|
<template v-else><i class="ph-caret-down ph-bold ph-lg"></i></template>
|
2020-01-29 19:37:25 +00:00
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</header>
|
2020-04-16 14:13:33 +00:00
|
|
|
<div v-show="showBody" class="body">
|
2020-01-29 19:37:25 +00:00
|
|
|
<slot></slot>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2023-05-14 02:43:56 +00:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { ref } from 'vue';
|
2023-09-19 07:37:43 +00:00
|
|
|
import { i18n } from '@/i18n.js';
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2023-05-14 02:43:56 +00:00
|
|
|
const props = withDefaults(defineProps<{
|
|
|
|
expanded?: boolean;
|
|
|
|
removable?: boolean;
|
|
|
|
draggable?: boolean;
|
|
|
|
}>(), {
|
|
|
|
expanded: true,
|
|
|
|
removable: true,
|
2020-01-29 19:37:25 +00:00
|
|
|
});
|
2023-05-14 02:43:56 +00: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 19:37:25 +00:00
|
|
|
</script>
|
|
|
|
|
2022-12-27 09:29:39 +00:00
|
|
|
<style lang="scss" scoped>
|
2020-01-29 19:37:25 +00:00
|
|
|
.cpjygsrt {
|
|
|
|
position: relative;
|
2021-03-02 13:57:16 +00:00
|
|
|
overflow: hidden;
|
2020-01-29 19:37:25 +00:00
|
|
|
background: var(--panel);
|
2020-07-04 18:49:58 +00:00
|
|
|
border: solid 2px var(--X12);
|
2022-12-24 02:57:06 +00:00
|
|
|
border-radius: 8px;
|
2020-01-29 19:37:25 +00:00
|
|
|
|
|
|
|
&:hover {
|
2020-07-04 18:49:58 +00:00
|
|
|
border: solid 2px var(--X13);
|
2020-01-29 19:37:25 +00: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 14:22:59 +00:00
|
|
|
> i {
|
2020-01-29 19:37:25 +00: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 14:13:33 +00:00
|
|
|
> .body {
|
2020-10-17 11:12:00 +00:00
|
|
|
::v-deep(.juejbjww), ::v-deep(.eiipwacr) {
|
2020-04-16 14:13:33 +00:00
|
|
|
&:not(.inline):first-child {
|
|
|
|
margin-top: 28px;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:not(.inline):last-child {
|
|
|
|
margin-bottom: 20px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-01-29 19:37:25 +00:00
|
|
|
}
|
|
|
|
</style>
|