Add footer to article

This commit is contained in:
Michal Vanko 2020-06-16 15:27:06 +02:00
parent cf93558a4e
commit a6e7d42d84
3 changed files with 63 additions and 51 deletions

View File

@ -0,0 +1,57 @@
<script>
import { format } from 'date-fns'
export let post
</script>
<style>
.tags-list {
list-style: none;
margin: 0;
padding: 0;
display: inline;
}
.tags-list li {
display: inline;
font-style: italic;
}
.lighten {
color: #595a8f;
}
time {
font-style: italic;
}
footer {
display: flex;
font-size: 0.85em;
justify-content: space-between;
padding-top: 0.2em;
margin-top: 0.4em;
border-top: 1px solid #c0c1e1;
}
</style>
<footer>
<div class="article-tags">
{#if post.tags.length > 0}
<span class="lighten">Tags:</span>
<ul class="tags-list">
{#each post.tags as tag}
<li>
<a href="blog?tag={tag}">{tag}</a>
</li>
{/each}
</ul>
{/if}
</div>
<div class="created-at">
<span class="lighten">Published on</span>
<time datetime={post.date}>
{format(new Date(post.date), "do MMMM',' y")}
</time>
</div>
</footer>

View File

@ -14,6 +14,8 @@
</script>
<script>
import ArticleFooter from '../../components/blog/article-footer.svelte'
export let post
</script>
@ -73,3 +75,5 @@
<div class="content">
{@html post.body}
</div>
<ArticleFooter post={post} />

View File

@ -15,7 +15,7 @@
</script>
<script>
import { format } from 'date-fns'
import ArticleFooter from '../../components/blog/article-footer.svelte'
export let posts
export let query
@ -33,35 +33,6 @@
margin-bottom: 2em;
}
.tags-list {
list-style: none;
margin: 0;
padding: 0;
display: inline;
}
.tags-list li {
display: inline;
font-style: italic;
}
time {
font-style: italic;
}
footer {
display: flex;
font-size: 0.85em;
justify-content: space-between;
padding-top: 0.2em;
margin-top: 0.4em;
border-top: 1px solid #c0c1e1;
}
.lighten {
color: #595a8f;
}
.see-all {
text-align: end;
margin-top: -1.5em;
@ -102,28 +73,8 @@
</h2>
</header>
{@html post.preview}
<footer>
<div class="article-tags">
{#if post.tags.length > 0}
<span class="lighten">Tags:</span>
<ul class="tags-list">
{#each post.tags as tag}
<li>
<a href="blog?tag={tag}">{tag}</a>
</li>
{/each}
</ul>
{/if}
</div>
<div class="created-at">
<span class="lighten">Published on</span>
<time datetime={post.date}>
{format(new Date(post.date), "do MMMM',' y")}
</time>
</div>
</footer>
</article>
<ArticleFooter post={post} />
</li>
{/each}
</ul>