rudeshark.net/packages/client/src/components/MkEmojiPicker.section.vue

44 lines
966 B
Vue
Raw Normal View History

2021-02-27 11:53:20 +01:00
<template>
2023-04-08 02:01:42 +02:00
<!-- このコンポーネントの要素のclassは親から利用されるのでむやみに弄らないこと -->
<section>
<header class="_acrylic" @click="shown = !shown">
<i
class="toggle ph-fw ph-lg"
:class="
shown
? 'ph-caret-down-bold ph-lg'
: 'ph-caret-up ph-bold ph-lg'
"
></i>
<slot></slot> ({{ emojis.length }})
</header>
<div v-if="shown" class="body">
<button
v-for="emoji in emojis"
:key="emoji"
class="_button item"
@click="emit('chosen', emoji, $event)"
>
<MkEmoji class="emoji" :emoji="emoji" :normal="true" />
</button>
</div>
</section>
2021-02-27 11:53:20 +01:00
</template>
<script lang="ts" setup>
2023-04-08 02:01:42 +02:00
import { ref } from "vue";
2021-02-27 11:53:20 +01:00
const props = defineProps<{
emojis: string[];
initialShown?: boolean;
}>();
2021-02-27 11:53:20 +01:00
const emit = defineEmits<{
2023-04-08 02:01:42 +02:00
(ev: "chosen", v: string, event: MouseEvent): void;
}>();
2021-02-27 11:53:20 +01:00
const shown = ref(!!props.initialShown);
2021-02-27 11:53:20 +01:00
</script>
2023-04-08 02:01:42 +02:00
<style lang="scss" scoped></style>