<script>
	/**
	 * Un objeto con los datos que llegan de la funcion load de +page.js
	 * @typedef {{
	 * slug: string;
	 * templateIndex: number;
	 * templateImage: string;
	 * }}
	 * LoadFunctionData
	 */

	/** @type LoadFunctionData */ export let data;

	import Form from '$lib/form/Form.svelte';
	import Preview from '$lib/preview/Preview.svelte';

	const templateIndex = data.templateIndex;
	const templateImage = data.templateImage;
</script>

<svelte:head>
	<title>Carteles DMD - Plantilla {data.slug}</title>
</svelte:head>

<div class="main">
	<section class="form"><Form /></section>

	{#if templateIndex !== undefined}
		<section class="preview">
			<Preview {templateIndex} {templateImage} />
		</section>
	{/if}
</div>

<style>
	.main {
		display: grid;
		grid-template-columns: 1fr 616px;
		grid-gap: 0.5rem;
		min-height: calc(100vh - 5rem);
	}

	.form {
		grid-column: 1/2;
		background-color: rgb(236, 240, 240);
	}

	.preview {
		grid-column: 2/3;
		background-color: rgb(240, 240, 240);
	}
</style>
