BlogInfoList.vue 4.86 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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
<template>
  <div class="blog-info-list">
    <div class="switch-wrapper">
      <button class="switch-button" @click="setActive('article')">
        <div
          class="icon-wapper"
          :class="{ active: active === 'article' }"
          :aria-label="i18n.article"
          data-balloon-pos="up"
        >
          <ArticleIcon />
        </div>
      </button>
      <button class="switch-button" @click="setActive('category')">
        <div
          class="icon-wapper"
          :class="{ active: active === 'category' }"
          :aria-label="i18n.category"
          data-balloon-pos="up"
        >
          <CategoryIcon />
        </div>
      </button>
      <button class="switch-button" @click="setActive('tag')">
        <div
          class="icon-wapper"
          :class="{ active: active === 'tag' }"
          :aria-label="i18n.tag"
          data-balloon-pos="up"
        >
          <TagIcon />
        </div>
      </button>
      <button class="switch-button" @click="setActive('timeline')">
        <div
          class="icon-wapper"
          :class="{ active: active === 'timeline' }"
          :aria-label="i18n.timeline"
          data-balloon-pos="up"
        >
          <TimeIcon />
        </div>
      </button>
    </div>

    <!-- Article -->
    <MyTransition v-if="active === 'article'">
      <div class="sticky-article-wrapper">
        <div class="title" @click="navigate('/article/')">
          <ArticleIcon />
          <span class="num">{{ articleNumber }}</span>
          {{ i18n.article }}
        </div>
        <hr />
        <ul class="sticky-article-list">
          <MyTransition
            v-for="(article, index) in $starArticles"
            :key="article.path"
            :delay="(index + 1) * 0.08"
          >
            <li
              class="sticky-article"
              @click="navigate(article.path)"
              v-text="article.title"
            />
          </MyTransition>
        </ul>
      </div>
    </MyTransition>

    <!-- Category -->
    <MyTransition v-if="active === 'category'">
      <div class="category-wrapper">
        <div
          v-if="$category.list.length !== 0"
          class="title"
          @click="navigate('/category/')"
        >
          <CategoryIcon />
          <span class="num">{{ $category.list.length }}</span>
          {{ i18n.category }}
        </div>
        <hr />
        <MyTransition :delay="0.04">
          <CategoryList />
        </MyTransition>
      </div>
    </MyTransition>

    <!-- Tags -->
    <MyTransition v-if="active === 'tag'">
      <div class="tag-wrapper">
        <div
          v-if="$tag.list.length !== 0"
          class="title"
          @click="navigate('/tag/')"
        >
          <TagIcon />
          <span class="num">{{ $tag.list.length }}</span>
          {{ i18n.tag }}
        </div>
        <hr />
        <MyTransition :delay="0.04">
          <TagList />
        </MyTransition>
      </div>
    </MyTransition>

    <!-- Timeline -->
    <MyTransition v-if="active === 'timeline'">
      <TimelineList />
    </MyTransition>
  </div>
</template>
<script src="./BlogInfoList" />
<style lang="stylus">
@require '~@mr-hope/vuepress-shared/styles/reset'

.blog-info-list
  margin 8px auto
  padding 8px 16px

  .page &
    background var(--bgcolor)
    border-radius 6px
    box-shadow 0 1px 3px 0 var(--card-shadow-color)

    &:hover
      box-shadow 0 2px 6px 0 var(--card-shadow-color)

  .switch-wrapper
    display flex
    justify-content center
    margin-bottom 8px

    .switch-button
      button()
      width 44px
      height 44px
      margin 0 8px
      padding 4px
      color var(--grey3)

      &:focus
        outline none

      .icon-wapper
        width 20px
        height 20px
        padding 8px
        border-radius 50%
        background rgba(127, 127, 127, 0.15)

        .theme-dark &
          background rgba(255, 255, 255, 0.15)

        &:hover
          cursor pointer

        &.active
          .theme-light &
            background var(--accent-color-l10)

          .theme-dark &
            background var(--accent-color-d10)

        .icon
          width 100%
          height 100%

  .sticky-article-wrapper, .category-wrapper, .tag-wrapper
    padding 8px 0

    .title
      cursor pointer

      .icon
        position relative
        bottom -0.125rem
        width 16px
        height 16px
        margin 0 6px

      .num
        position relative
        margin 0 2px
        font-size 22px

  .sticky-article-wrapper
    .sticky-article-list
      margin 8px auto

      .sticky-article
        padding 12px 8px 4px
        border-bottom 1px dashed var(--grey14)

        &:hover
          cursor pointer
          color var(--accent-color)

  .category-wrapper
    .category-list-wrapper
      margin 8px auto

  .tag-wrapper
    .tag-list-wrapper
      margin 8px auto

  .page &
    .timeline-list-wrapper
      .content
        max-height 60vh
</style>