tweak component

This commit is contained in:
syuilo 2021-12-10 21:41:37 +09:00
parent 0f7241c2c2
commit 48212e7a44

View file

@ -1,7 +1,8 @@
<template> <template>
<div class="ogwlenmc"> <MkSpacer :content-max="900">
<div class="ogwlenmc">
<div v-if="tab === 'local'" class="local"> <div v-if="tab === 'local'" class="local">
<MkInput v-model="query" :debounce="true" type="search" style="margin: var(--margin);"> <MkInput v-model="query" :debounce="true" type="search">
<template #prefix><i class="fas fa-search"></i></template> <template #prefix><i class="fas fa-search"></i></template>
<template #label>{{ $ts.search }}</template> <template #label>{{ $ts.search }}</template>
</MkInput> </MkInput>
@ -22,13 +23,15 @@
</div> </div>
<div v-else-if="tab === 'remote'" class="remote"> <div v-else-if="tab === 'remote'" class="remote">
<MkInput v-model="queryRemote" :debounce="true" type="search" style="margin: var(--margin);"> <div class="_inputSplit">
<MkInput v-model="queryRemote" :debounce="true" type="search">
<template #prefix><i class="fas fa-search"></i></template> <template #prefix><i class="fas fa-search"></i></template>
<template #label>{{ $ts.search }}</template> <template #label>{{ $ts.search }}</template>
</MkInput> </MkInput>
<MkInput v-model="host" :debounce="true" style="margin: var(--margin);"> <MkInput v-model="host" :debounce="true">
<template #label>{{ $ts.host }}</template> <template #label>{{ $ts.host }}</template>
</MkInput> </MkInput>
</div>
<MkPagination ref="remoteEmojis" :pagination="remotePagination"> <MkPagination ref="remoteEmojis" :pagination="remotePagination">
<template #empty><span>{{ $ts.noCustomEmojis }}</span></template> <template #empty><span>{{ $ts.noCustomEmojis }}</span></template>
<template v-slot="{items}"> <template v-slot="{items}">
@ -44,7 +47,8 @@
</template> </template>
</MkPagination> </MkPagination>
</div> </div>
</div> </div>
</MkSpacer>
</template> </template>
<script lang="ts"> <script lang="ts">
@ -78,6 +82,9 @@ export default defineComponent({
icon: 'fas fa-plus', icon: 'fas fa-plus',
text: this.$ts.addEmoji, text: this.$ts.addEmoji,
handler: this.add, handler: this.add,
}, {
icon: 'fas fa-ellipsis-h',
handler: this.menu,
}], }],
tabs: [{ tabs: [{
active: this.tab === 'local', active: this.tab === 'local',
@ -160,6 +167,28 @@ export default defineComponent({
icon: 'fas fa-plus', icon: 'fas fa-plus',
action: () => { this.im(emoji) } action: () => { this.im(emoji) }
}], ev.currentTarget || ev.target); }], ev.currentTarget || ev.target);
},
menu(ev) {
os.popupMenu([{
icon: 'fas fa-download',
text: this.$ts.export,
action: async () => {
os.api('export-custom-emojis', {
})
.then(() => {
os.alert({
type: 'info',
text: this.$ts.exportRequested,
});
}).catch((e) => {
os.alert({
type: 'error',
text: e.message,
});
});
}
}], ev.currentTarget || ev.target);
} }
} }
}); });
@ -176,7 +205,7 @@ export default defineComponent({
display: grid; display: grid;
grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
grid-gap: 12px; grid-gap: 12px;
margin: var(--margin); margin: var(--margin) 0;
> .emoji { > .emoji {
display: flex; display: flex;
@ -222,7 +251,7 @@ export default defineComponent({
display: grid; display: grid;
grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
grid-gap: 12px; grid-gap: 12px;
margin: var(--margin); margin: var(--margin) 0;
> .emoji { > .emoji {
display: flex; display: flex;