Skip to content
Snippets Groups Projects
BlogsPage.vue 1.95 KiB
Newer Older
<template>
  <div>
ivelov-vm's avatar
ivelov-vm committed
    <HeaderComponent current-page="blogs" :with-shadow="scroll > 50"></HeaderComponent>
    <div class="overflow-hidden">
ivelov-vm's avatar
ivelov-vm committed
      <section class="relative z-10 px-[6.7%] mt-[63px]">
        <h1 class="text-black text-[2rem]">
          Blog
          <FeatureSvg
ivelov-vm's avatar
ivelov-vm committed
            class="inline absolute -top-[6px] -translate-x-[3px] text-blue gap-x-10 w-6 h-6"
          ></FeatureSvg>
        </h1>

ivelov-vm's avatar
ivelov-vm committed
        <ul class="mt-2">
          <li v-for="blog in blogs" :key="blog.id" >
            <article class="p-4 mt-6 rounded-2xl bg-white shadow-3x28">
              <img :src="blog.image" alt="Title image" class="w-full mb-4">
ivelov-vm's avatar
ivelov-vm committed
              <router-link :to="`/blogs/${blog.id}`" class="font-medium text-xl text-dark leading-[1.66rem] hover:text-blue-text transition-colors">
ivelov-vm's avatar
ivelov-vm committed
                {{ blog.title }}
              </router-link>
              <p class="mt-2 leading-5 text-gray-text">
                <small>{{ blog.date }}</small>
              </p>
              <p class="mt-4 text-gray-600">
                {{ blog.content.length > 340? blog.content.slice(0, 340) + '...' : blog.content}}
              </p>
            </article>
ivelov-vm's avatar
ivelov-vm committed
          </li>
        </ul>
      </section>

ivelov-vm's avatar
ivelov-vm committed
      <FooterComponent class="mt-[92px]"></FooterComponent>
    </div>
  </div>
</template>

<script>
import HeaderComponent from "../components/HeaderComponent.vue";
import FeatureSvg from "../components/svg/FeatureSvg.vue";
ivelov-vm's avatar
ivelov-vm committed
import BlogsMixin from "../components/mixins/BlogsMixin.vue";
import FooterComponent from "../components/FooterComponent.vue";

export default {
ivelov-vm's avatar
ivelov-vm committed
  name: "BlogsPage",
  data() {
    return {
ivelov-vm's avatar
ivelov-vm committed
      scroll: window.scrollY
    };
  },
  mounted() {
ivelov-vm's avatar
ivelov-vm committed
    window.addEventListener('scroll', this.onScroll);
  },
  beforeDestroy() {
    window.removeEventListener("scroll", this.onScroll);
  },
  methods: {
ivelov-vm's avatar
ivelov-vm committed
    onScroll(){
      this.scroll = window.scrollY;
ivelov-vm's avatar
ivelov-vm committed
  components: { HeaderComponent, FeatureSvg, FooterComponent },
  mixins: [BlogsMixin],
};
</script>