<template>
	<main>
		<section>
			<h1 class="title">{{ data.title }}</h1>
			<img :src="'http://localhost:1337' + data.cover.url" alt="" />
			<div class="description">{{ data.description }}</div>
		</section>
		<aside>
			<h3>Functions</h3>
			<ul>
				<li v-for="tool in toolkit" :key="tool.id">
					<nuxt-link :to="`/functions/${tool.name}`">
						{{ tool.name }}
					</nuxt-link>
				</li>
			</ul>
		</aside>
	</main>
</template> 

<script>
export default {
	async asyncData({ $strapi }) {
		const toolkit = await $strapi.find('functions')
		const data = await $strapi.find('sp-16')
		return { toolkit, data }
	},
}
</script>

<style scoped>
main {
	display: flex;
}

main > * {
	padding: 24px;
}

.description {
	margin: 24px 0;
	width: 80ch;
	white-space: pre-line;
}
</style>
