This commit is contained in:
syuilo 2021-04-16 23:04:25 +09:00
parent b4308ecb91
commit 0f054aed88
3 changed files with 69 additions and 28 deletions

View file

@ -1,16 +1,20 @@
<template> <template>
<div class="_formItem" v-if="pending"> <transition name="fade" mode="out-in">
<div class="_formPanel"> <div class="_formItem" v-if="pending">
pending <div class="_formPanel">
<MkLoading/>
</div>
</div> </div>
</div> <div v-else-if="resolved">
<slot v-else-if="resolved" :result="result"></slot> <slot :result="result"></slot>
<div class="_formItem" v-else>
<div class="_formPanel">
error!
<button @click="retry">retry</button>
</div> </div>
</div> <div class="_formItem" v-else>
<div class="_formPanel">
error!
<button @click="retry">retry</button>
</div>
</div>
</transition>
</template> </template>
<script lang="ts"> <script lang="ts">
@ -72,5 +76,13 @@ export default defineComponent({
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.125s ease;
}
.fade-enter-from,
.fade-leave-to {
opacity: 0;
}
</style> </style>

View file

@ -1,5 +1,5 @@
<template> <template>
<div class="yxspomdl" :class="{ inline }"> <div class="yxspomdl" :class="{ inline, colored }">
<div class="ring"></div> <div class="ring"></div>
</div> </div>
</template> </template>
@ -14,6 +14,11 @@ export default defineComponent({
type: Boolean, type: Boolean,
required: false, required: false,
default: false default: false
},
colored: {
type: Boolean,
required: false,
default: true
} }
} }
}); });
@ -32,6 +37,11 @@ export default defineComponent({
.yxspomdl { .yxspomdl {
padding: 32px; padding: 32px;
text-align: center; text-align: center;
cursor: wait;
&.colored {
color: var(--accent);
}
&.inline { &.inline {
display: inline; display: inline;
@ -41,24 +51,43 @@ export default defineComponent({
width: 32px; width: 32px;
height: 32px; height: 32px;
} }
> .ring {
&:before,
&:after {
width: 32px;
height: 32px;
}
}
} }
> .ring { > .ring {
position: relative;
display: inline-block; display: inline-block;
opacity: 0.7;
vertical-align: middle; vertical-align: middle;
}
> .ring:after { &:before,
content: " "; &:after {
display: block; content: " ";
box-sizing: border-box; display: block;
width: 48px; box-sizing: border-box;
height: 48px; width: 48px;
border-radius: 50%; height: 48px;
border: solid 4px; border-radius: 50%;
border-color: currentColor transparent transparent transparent; border: solid 4px;
animation: ring 0.5s linear infinite; }
&:before {
border-color: currentColor;
opacity: 0.3;
}
&:after {
position: absolute;
top: 0;
border-color: currentColor transparent transparent transparent;
animation: ring 0.5s linear infinite;
}
} }
} }
</style> </style>

View file

@ -1,8 +1,8 @@
<template> <template>
<FormBase> <FormBase>
<FormGroup> <FormSuspense :p="apPromiseFactory" v-slot="{ result: ap }">
<template #label>ActivityPub</template> <FormGroup>
<FormSuspense :p="apPromiseFactory" v-slot="{ result: ap }"> <template #label>ActivityPub</template>
<FormKeyValueView> <FormKeyValueView>
<template #key>Type</template> <template #key>Type</template>
<template #value><span class="_monospace">{{ ap.type }}</span></template> <template #value><span class="_monospace">{{ ap.type }}</span></template>
@ -48,8 +48,8 @@
<template #key>{{ $ts.instanceInfo }}</template> <template #key>{{ $ts.instanceInfo }}</template>
<template #value>(Local user)</template> <template #value>(Local user)</template>
</FormKeyValueView> </FormKeyValueView>
</FormSuspense> </FormGroup>
</FormGroup> </FormSuspense>
</FormBase> </FormBase>
</template> </template>