<script>
	import { templates } from '$lib/templates/templates';

	/** @type number */ export let templateIndex;
	import { subtitle } from '$lib/stores/store';
</script>

{#if templates[templateIndex] && $subtitle}
	<div
		class="subtitle"
		style="
    top: {templates[templateIndex].subtitle.top}px;
    height: {templates[templateIndex].subtitle.height}rem;
    left: {templates[templateIndex].subtitle.left}rem;
    right: {templates[templateIndex].subtitle.right}rem;
    color: {templates[templateIndex].subtitle.color};
    font-size: {templates[templateIndex].subtitle.fontSize}rem;
    font-family: {templates[templateIndex].subtitle.fontFamily};
		text-align: {templates[templateIndex].subtitle.textAlign};
		font-weight: {templates[templateIndex].subtitle.fontWeight};
		line-height: {templates[templateIndex].subtitle.lineHeight}rem;
    "
	>
		{$subtitle}
	</div>
{/if}

<style>
	.subtitle {
		position: absolute;
		font-variant: small-caps;
		overflow: hidden;
		display: flex;
		justify-content: center;
		align-items: start;
	}
</style>
