2021-08-19 11:12:13 -07:00
|
|
|
<template>
|
|
|
|
<div class="columnist-wall row">
|
|
|
|
<div v-for="post in posts" class="columnist-column col-12 col-sm-6 col-md-4 mb-3">
|
|
|
|
<div class="card shadow">
|
2022-01-19 05:22:40 -08:00
|
|
|
<nuxt-link v-if="post.hero" :to="generateLink(post.slug)" class="">
|
2021-08-19 11:12:13 -07:00
|
|
|
<img :src="post.hero" class="w-100"/>
|
|
|
|
</nuxt-link>
|
2022-01-19 05:22:40 -08:00
|
|
|
<nuxt-link :to="generateLink(post.slug)" class="card-body text-center h4 p-3 mb-0">
|
2021-11-15 13:17:50 -08:00
|
|
|
<Spelling :text="post.title"/>
|
2021-08-19 11:12:13 -07:00
|
|
|
</nuxt-link>
|
2022-01-19 14:46:28 -08:00
|
|
|
<div v-if="details" class="card-footer small">
|
2021-08-19 11:12:13 -07:00
|
|
|
<ul class="list-inline mb-0">
|
|
|
|
<li class="list-inline-item small">
|
|
|
|
<Icon v="calendar"/>
|
|
|
|
{{post.date}}
|
|
|
|
</li>
|
|
|
|
<li v-for="author in post.authors" class="list-inline-item">
|
|
|
|
<nuxt-link v-if="author.startsWith('@')" :to="`/${author}`" class="badge bg-light text-dark border">
|
|
|
|
<Icon v="collective-logo.svg" class="invertible"/>
|
|
|
|
{{author}}
|
|
|
|
</nuxt-link>
|
|
|
|
<span v-else class="badge bg-light text-dark border">
|
2021-11-15 13:17:50 -08:00
|
|
|
{{author}}
|
|
|
|
</span>
|
2021-08-19 11:12:13 -07:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import Columnist from 'avris-columnist';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
posts: { required: true },
|
2022-01-19 14:46:28 -08:00
|
|
|
details: { type: Boolean },
|
2021-08-19 11:12:13 -07:00
|
|
|
},
|
2022-01-19 05:22:40 -08:00
|
|
|
data() {
|
|
|
|
const shortcuts = {};
|
|
|
|
for (let shortcut in this.config.blog.shortcuts) {
|
|
|
|
if (!this.config.blog.shortcuts.hasOwnProperty(shortcut)) { continue; }
|
|
|
|
shortcuts[this.config.blog.shortcuts[shortcut]] = shortcut;
|
|
|
|
}
|
|
|
|
|
|
|
|
return { shortcuts };
|
|
|
|
},
|
2021-08-19 11:12:13 -07:00
|
|
|
mounted() {
|
|
|
|
if (!process.client) { return; }
|
|
|
|
|
|
|
|
const columnist = new Columnist(this.$el);
|
|
|
|
columnist.start();
|
|
|
|
},
|
2022-01-19 05:22:40 -08:00
|
|
|
methods: {
|
|
|
|
generateLink(slug) {
|
|
|
|
return this.shortcuts[slug] !== undefined
|
2022-01-19 05:37:00 -08:00
|
|
|
? `/${this.shortcuts[slug]}`
|
2022-01-19 05:22:40 -08:00
|
|
|
: `/blog/${slug}`;
|
|
|
|
}
|
2022-01-19 14:46:28 -08:00
|
|
|
},
|
2021-08-19 11:12:13 -07:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.columnist-wall > .columnist-column {
|
|
|
|
transition: margin-top .2s ease-in-out;
|
|
|
|
}
|
|
|
|
</style>
|