<script setup lang="ts">
import { inject } from "vue";

const close = inject<() => void>("close");
const canClose = inject<boolean>("canClose");

if (!close) {
  throw new Error("ModalClose must be used within a Modal component");
}
</script>

<template>
  <div v-if="canClose" @click="close">
    <slot />
  </div>
</template>
