hippofish/packages/client/src/components/MkEmojiPicker.section.vue
ThatOneCalculator 3de967393b
icons
2023-03-11 13:01:04 -08:00

36 lines
912 B
Vue

<template>
<!-- このコンポーネントの要素の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>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
const props = defineProps<{
emojis: string[];
initialShown?: boolean;
}>();
const emit = defineEmits<{
(ev: 'chosen', v: string, event: MouseEvent): void;
}>();
const shown = ref(!!props.initialShown);
</script>
<style lang="scss" scoped>
</style>