<template>
    <div class="md:grid md:grid-cols-3 md:gap-6">
        <div class="md:col-span-1">
            <div class="px-4 sm:px-0">
                <h3 class="text-lg font-medium leading-6 text-surface-900">{{ title }}</h3>
                <p class="mt-1 text-sm text-surface-500">
                    {{ description }}
                </p>
            </div>
        </div>
        <div class="mt-5 md:mt-0 md:col-span-2">
            <form @submit.prevent="$emit('submitted')">
                <div class="shadow-sm sm:rounded-tl-2xl sm:rounded-tr-2xl bg-white border border-surface-200">
                    <div class="px-4 py-5 sm:p-6 lg:p-8">
                        <div class="grid grid-cols-6 gap-6">
                            <slot name="form"></slot>
                        </div>
                    </div>
                </div>

                <div v-if="$slots.actions" class="flex items-center justify-end px-4 py-4 bg-surface-50 border border-t-0 border-surface-200 text-right sm:px-6 shadow-sm sm:rounded-bl-2xl sm:rounded-br-2xl">
                    <slot name="actions"></slot>
                </div>
            </form>
        </div>
    </div>
</template>

<script setup>
defineProps({
    title: String,
    description: String,
});

defineEmits(['submitted']);
</script>
