[+] Breadcrumbs

This commit is contained in:
Hykilpikonna
2021-12-26 22:48:29 -05:00
parent 6bbdaf4ad3
commit 3f5979b84f
+24
View File
@@ -1,5 +1,11 @@
<template> <template>
<div id="Blog"> <div id="Blog">
<div id="breadcrumb">
<span>Blog</span>
<span v-if="tag">🏷{{tag}}</span>
<span v-if="category">📂{{category}}</span>
<span class="no-after" v-if="activePost">{{activePost.title}}</span>
</div>
<BlogPostPreview v-for="m of filteredPosts" :key="m" :meta="m" <BlogPostPreview v-for="m of filteredPosts" :key="m" :meta="m"
:active="post ? m.url_name === post : m === filteredPosts[0] && m.pinned"/> :active="post ? m.url_name === post : m === filteredPosts[0] && m.pinned"/>
</div> </div>
@@ -34,6 +40,12 @@ export default class Blog extends Vue
}) })
} }
get activePost(): BlogPost | null
{
const p = this.filteredPosts
return this.post ? p.filter(it => it.url_name == this.post)[0] : p[0].pinned ? p[0] : null
}
get filteredPosts(): BlogPost[] get filteredPosts(): BlogPost[]
{ {
const posts = this.meta.posts.filter(it => it.pinned || (this.tag ? it.tags.includes(this.tag) : const posts = this.meta.posts.filter(it => it.pinned || (this.tag ? it.tags.includes(this.tag) :
@@ -48,12 +60,24 @@ export default class Blog extends Vue
</script> </script>
<style lang="sass" scoped> <style lang="sass" scoped>
@import "src/css/colors"
$width: 600px $width: 600px
#Blog #Blog
width: $width width: $width
margin: 20px auto margin: 20px auto
#breadcrumb
color: $color-text-light
margin-bottom: 20px
text-align: left
span:not(.no-after):after
content: ">"
margin: 0 10px
// Phone layout // Phone layout
@media screen and (max-width: $width + 40px) @media screen and (max-width: $width + 40px)
#Blog #Blog