<template>
  <NewsListingBlock
    :block-options="blockOptions"
    :filters="filters"
    :fractions="3"
    :pagination="false"
  >
    <template #newsItem="{ item }">
      <Minimal
        :key="item.uuid"
        v-bind="item"
        :staggered="true"
        :to="{
          name: 'NewsPage',
          params: { slug: item.slug[0] }
        }"
      />
    </template>
  </NewsListingBlock>
</template>

<script>
import NewsListingBlock from '@inside-news/components/lib/NewsListingBlock'
import Minimal from '@inside-news/components/lib/Minimal'

export default {
  name: 'HomeNewsListing',
  $_i18nRootPath: 'customs.HOMEPAGE.news',
  components: { NewsListingBlock, Minimal },
  computed: {
    blockOptions() {
      return {
        title: this.$_tr('title'),
        titleTag: 'h3',
        link: { name: 'NewsListingPage' },
        linkLabel: this.$_tr('link'),
        titleOptions: { alignment: 'center' }
      }
    },
    filters() {
      return {
        'status:eq': 1,
        'is_featured:eq': 1,
        'archived:eq': 0,
        'published_at:lte': 'now()',
        sort: 'published_at:desc',
        limit: 3
      }
    }
  }
}
</script>
