<template>
  <div class="flex flex-col h-fit w-full border border-primary rounded-md">
    <RouterLink
      :to="{ name: 'admin-club-newsletter-overview', params: { newsletterId: newsletter.id } }"
      class="bg-primary p-2 text-white flex flex-row justify-between items-center"
    >
      <p>{{ newsletter.title }}</p>
      <PaperAirplaneIcon v-if="newsletter.isSent" class="w-5 h-5" />
    </RouterLink>
    <div class="p-2 max-h-48 overflow-y-auto">
      <p v-html="newsletter.description"></p>
    </div>
  </div>
</template>

<script setup lang="ts">
import { defineComponent, type PropType } from "vue";
import { mapState, mapActions } from "pinia";
import type { NewsletterViewModel } from "@/viewmodels/admin/club/newsletter/newsletter.models";
import { PaperAirplaneIcon } from "@heroicons/vue/24/outline";
</script>

<script lang="ts">
export default defineComponent({
  props: {
    newsletter: { type: Object as PropType<NewsletterViewModel>, default: {} },
  },
});
</script>
