<template>
  <NewsListingBlock
    :fractions="3"
    :filters="filters"
    :pagination="false"
    :block-options="blockOptions"
    class="mt-xl"
  >
    <template #newsItem="{ item }">
      <Minimal
        v-bind="item"
        :key="item.uuid"
        :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',
  components: { NewsListingBlock, Minimal },
  data() {
    return {
      blockOptions: {
        title: this.$t('customs.HOMEPAGE.NEWS_LISTING.title'),
        titleTag: 'h3',
        link: {
          name: 'NewsListingPage'
        },
        linkLabel: this.$t('customs.HOMEPAGE.NEWS_LISTING.more')
      }
    }
  },
  computed: {
    filters() {
      return {
        'status:eq': 1,
        sort: 'published_at:desc',
        'published_at:lte': 'now()',
        'is_featured:eq': 0,
        limit: 3
      }
    }
  }
}
</script>
