ArticleInfo.vue 1.52 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
<template>
  <div v-if="author || time" class="article-info">
    <!-- Author -->
    <span v-if="author" :aria-label="authorText" data-balloon-pos="down">
      <AuthorIcon />
      <span property="author" v-text="author" />
    </span>

    <!-- Writing Date -->
    <span
      v-if="time"
      class="time"
      :aria-label="timeText"
      data-balloon-pos="down"
    >
      <CalendarIcon />
      <span property="datePublished" v-text="time" />
    </span>

    <CategoryInfo
      v-if="article.frontmatter.category"
      :category="article.frontmatter.category"
    />

    <TagInfo v-if="tags.length !== 0" :tags="tags" />

    <!-- Reading time -->
    <span
      v-if="readingTime"
      class="read-time-info"
      :aria-label="readingTimeText"
      data-balloon-pos="down"
    >
      <TimerIcon />
      <span v-text="readingTime" />
      <meta property="timeRequired" :content="readingTimeContent" />
    </span>
  </div>
</template>

<script src="./ArticleInfo" />

<style lang="stylus">
$articleInfoTextSize ?= 14px

.article-info
  color var(--dark-grey)
  font-size $articleInfoTextSize
  font-family Arial, Helvetica, sans-serif

  & > span
    display inline-block
    margin-right 0.5em
    line-height 1.8

    @media (max-width $MQMobileNarrow)
      margin-right 0.3em
      font-size 0.86rem

    &::after
      --balloon-font-size 8px
      padding 0.3em 0.6em !important

    svg
      position relative
      bottom -0.125em

    .tags-wrapper
      display inline-block

  .icon
    width 1em
    height 1em
</style>