<script setup>
import FixedLayout from '~/components/layouts/FixedLayout.vue';
import TableHeader from '~/components/parts/TableHeader.vue';

const slug = useRoute().params.slug;
const { locale } = useI18n();

const { data: post } = await useAsyncData(`blog-${slug}`, () => 
  queryCollection(`blog`).path(`/blog/${locale.value}/${slug}`).first()
, {watch: [locale]})
</script>

<template>
  <!-- Render the blog post as Prose & Vue components -->
  <div class="no-sprite">
      <TableHeader></TableHeader>
    </div>
  <FixedLayout>
    <Container>
      <ContentRenderer v-if="post" :value="post" class="blog" />
    </Container>
  </FixedLayout>
  <Footer></Footer>
</template>

<style lang="scss">
.blog {
    h2 {
        a {
            text-decoration: none;
            color: var(--color-text);
        }   
    }

    img {
        margin: auto;
        display: flex;
        max-height: 400px;
    }
}
</style>

<style lang="scss">
.no-sprite .undertable-wrapper {
  display: none;
}
</style>