<script lang="ts">
  export let isOpen: boolean;
  export let onClose: () => void;
</script>

{#if isOpen}
  <dialog class="backdrop" open={isOpen}>
    <div class="dialog">
      <slot />
      <button on:click={() => onClose()}>Close</button>
    </div>
  </dialog>
{/if}

<style>
  .backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .dialog {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
  }
</style>
