Skip to content

Commit

Permalink
feat: author chip on article-cards
Browse files Browse the repository at this point in the history
  • Loading branch information
limulus committed Jan 21, 2025
1 parent 5c10b5c commit 6a77dd8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
7 changes: 5 additions & 2 deletions www/_includes/components/article-card.webc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
<header>
<h1 @text="article.data.title"></h1>
<ul class="chips">
<li>
<author-chip :@article="article" @nolink="true"></author-chip>
</li>
<li>
<published-chip :@article="article"></published-chip>
</li>
Expand All @@ -34,11 +37,11 @@
</article-card>

<style webc:scoped>
:host a {
:host > article > a {
text-decoration: none;
}

:host a {
:host > article > a {
display: block;
overflow: hidden;
border: var(--card-border);
Expand Down
15 changes: 9 additions & 6 deletions www/_includes/components/author-chip.webc
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<data-chip :@pho="$data.authors[article.data.author].photo" :@article="article">
<a
:href="$data.authors[article.data.author].url"
@text="$data.authors[article.data.author].name"
></a>
</data-chip>
<script webc:type="js">
const chip = /* HTML */ `
<data-chip :@pho="$data.authors[article.data.author].photo" :@article="article">
${$data.authors[article.data.author].name}
</data-chip>
`

nolink ? chip : `<a href="${$data.authors[article.data.author].url}">${chip}</a>`
</script>

0 comments on commit 6a77dd8

Please sign in to comment.