-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move articles list and their items to dedicated components
- Loading branch information
Showing
4 changed files
with
47 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<script setup> | ||
import ArticlesListItem from './ArticlesListItem.vue'; | ||
const props = defineProps({ | ||
articles: { | ||
type: Array, | ||
required: true, | ||
} | ||
}) | ||
</script> | ||
|
||
<template> | ||
<ArticlesListItem v-for="article in articles" :article="article"/> | ||
</template> |
27 changes: 27 additions & 0 deletions
27
vitepress/.vitepress/theme/components/ArticlesListItem.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<script setup> | ||
import Tags from './Tags.vue'; | ||
const props = defineProps({ | ||
article: { | ||
type: Object, | ||
required: true, | ||
} | ||
}) | ||
const { | ||
excerpt, | ||
frontmatter: { title, publishedAt, tags }, | ||
url, | ||
} = props.article | ||
</script> | ||
|
||
<template> | ||
<h2><a :href="url" v-html="title"/></h2> | ||
|
||
<datetime :date="publishedAt" formatter="longdate"/> | ||
<tags :tags="tags" /> | ||
|
||
<p v-if="excerpt" v-html="excerpt"></p> | ||
|
||
<a :href="url">Continue reading</a> | ||
</template> |