2021-02-27 05:08:34 +01:00
|
|
|
<template>
|
2022-01-18 15:06:16 +01:00
|
|
|
<MkModal
|
|
|
|
ref="modal"
|
|
|
|
v-slot="{ type, maxHeight }"
|
|
|
|
:z-priority="'middle'"
|
|
|
|
:prefer-type="asReactionPicker && defaultStore.state.reactionPickerUseDrawerForMobile === false ? 'popup' : 'auto'"
|
|
|
|
:transparent-bg="true"
|
|
|
|
:manual-showing="manualShowing"
|
|
|
|
:src="src"
|
|
|
|
@click="modal?.close()"
|
|
|
|
@opening="opening"
|
|
|
|
@close="emit('close')"
|
|
|
|
@closed="emit('closed')"
|
|
|
|
>
|
|
|
|
<MkEmojiPicker
|
|
|
|
ref="picker"
|
|
|
|
class="ryghynhb _popup _shadow"
|
|
|
|
:class="{ drawer: type === 'drawer' }"
|
|
|
|
:show-pinned="showPinned"
|
|
|
|
:as-reaction-picker="asReactionPicker"
|
|
|
|
:as-drawer="type === 'drawer'"
|
|
|
|
:max-height="maxHeight"
|
|
|
|
@chosen="chosen"
|
|
|
|
/>
|
2021-12-16 18:14:40 +01:00
|
|
|
</MkModal>
|
2021-02-27 05:08:34 +01:00
|
|
|
</template>
|
|
|
|
|
2022-01-18 15:06:16 +01:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { ref } from 'vue';
|
2021-12-16 18:14:40 +01:00
|
|
|
import MkModal from '@/components/ui/modal.vue';
|
2021-11-11 18:02:25 +01:00
|
|
|
import MkEmojiPicker from '@/components/emoji-picker.vue';
|
2022-01-18 15:06:16 +01:00
|
|
|
import { defaultStore } from '@/store';
|
2021-02-27 05:08:34 +01:00
|
|
|
|
2022-01-18 15:06:16 +01:00
|
|
|
withDefaults(defineProps<{
|
2022-01-28 04:30:47 +01:00
|
|
|
manualShowing?: boolean | null;
|
2022-01-18 15:06:16 +01:00
|
|
|
src?: HTMLElement;
|
|
|
|
showPinned?: boolean;
|
|
|
|
asReactionPicker?: boolean;
|
|
|
|
}>(), {
|
2022-01-28 04:30:47 +01:00
|
|
|
manualShowing: null,
|
2022-01-18 15:06:16 +01:00
|
|
|
showPinned: true,
|
|
|
|
asReactionPicker: false,
|
|
|
|
});
|
2021-02-27 05:08:34 +01:00
|
|
|
|
2022-01-18 15:06:16 +01:00
|
|
|
const emit = defineEmits<{
|
2022-01-28 04:20:42 +01:00
|
|
|
(ev: 'done', v: any): void;
|
|
|
|
(ev: 'close'): void;
|
|
|
|
(ev: 'closed'): void;
|
2022-01-18 15:06:16 +01:00
|
|
|
}>();
|
2021-02-27 05:08:34 +01:00
|
|
|
|
2022-01-18 15:06:16 +01:00
|
|
|
const modal = ref<InstanceType<typeof MkModal>>();
|
|
|
|
const picker = ref<InstanceType<typeof MkEmojiPicker>>();
|
2021-02-27 05:08:34 +01:00
|
|
|
|
2022-01-18 15:06:16 +01:00
|
|
|
function chosen(emoji: any) {
|
|
|
|
emit('done', emoji);
|
|
|
|
modal.value?.close();
|
|
|
|
}
|
2021-02-28 02:03:52 +01:00
|
|
|
|
2022-01-18 15:06:16 +01:00
|
|
|
function opening() {
|
|
|
|
picker.value?.reset();
|
|
|
|
picker.value?.focus();
|
|
|
|
}
|
2021-02-27 05:08:34 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2021-08-09 11:01:12 +02:00
|
|
|
.ryghynhb {
|
2021-12-16 18:14:40 +01:00
|
|
|
&.drawer {
|
|
|
|
border-radius: 24px;
|
|
|
|
border-bottom-right-radius: 0;
|
|
|
|
border-bottom-left-radius: 0;
|
2021-02-27 05:08:34 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|