valaxy-theme-yun 0.14.27 → 0.14.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,6 +38,8 @@ const aside = computed(() => props.frontmatter.aside !== false)
38
38
  <slot name="main-content">
39
39
  <Transition appear>
40
40
  <ValaxyMd :frontmatter="frontmatter">
41
+ <YunMdTimeWarning :frontmatter="frontmatter" />
42
+
41
43
  <slot name="main-content-md" />
42
44
  <slot />
43
45
  </ValaxyMd>
@@ -0,0 +1,35 @@
1
+ <script lang="ts" setup>
2
+ import { computed } from 'vue'
3
+ import type { Post } from 'valaxy'
4
+
5
+ import dayjs from 'dayjs'
6
+ import relativeTime from 'dayjs/plugin/relativeTime'
7
+
8
+ import { useI18n } from 'vue-i18n'
9
+
10
+ const props = defineProps<{
11
+ frontmatter: Post
12
+ }>()
13
+
14
+ dayjs.extend(relativeTime)
15
+
16
+ const { t } = useI18n()
17
+
18
+ /**
19
+ * when the post is updated more than 30 days ago, show a warning
20
+ * default 30 days, you can set `time_warning` in frontmatter to change it
21
+ */
22
+ const time_warning = computed(() => {
23
+ const diff = dayjs().valueOf() - dayjs(props.frontmatter.updated).valueOf()
24
+ if (typeof props.frontmatter.time_warning === 'number')
25
+ return diff > props.frontmatter.time_warning
26
+ else
27
+ return props.frontmatter.time_warning || diff > 30 * 24 * 60 * 60 * 1000
28
+ })
29
+ </script>
30
+
31
+ <template>
32
+ <blockquote v-if="time_warning" op="80">
33
+ {{ t('post.time_warning', { ago: dayjs(frontmatter.updated).fromNow() }) }}
34
+ </blockquote>
35
+ </template>
@@ -35,9 +35,9 @@ const displayedPosts = computed(() =>
35
35
  </div>
36
36
  </template>
37
37
 
38
- <Transition v-for="route, i in displayedPosts" :key="i" name="fade">
39
- <YunPostCard :post="route" />
40
- </Transition>
38
+ <TransitionGroup name="fade">
39
+ <YunPostCard v-for="route, i in displayedPosts" :key="i" :post="route" />
40
+ </TransitionGroup>
41
41
  </div>
42
42
 
43
43
  <ValaxyPagination :cur-page="curPage" :page-size="pageSize" :total="posts.length" />
@@ -10,4 +10,8 @@ useTwikooWithOptions()
10
10
 
11
11
  <style lang="scss">
12
12
  // custom twikoo style
13
+ #twikoo .el-loading-spinner {
14
+ top: 65%;
15
+ right: -50%;
16
+ }
13
17
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valaxy-theme-yun",
3
- "version": "0.14.27",
3
+ "version": "0.14.29",
4
4
  "author": {
5
5
  "email": "me@yunyoujun.cn",
6
6
  "name": "YunYouJun",
@@ -18,12 +18,12 @@
18
18
  "types": "types/index.d.ts",
19
19
  "dependencies": {
20
20
  "@iconify-json/ant-design": "^1.1.5",
21
- "@iconify-json/simple-icons": "^1.1.49",
21
+ "@iconify-json/simple-icons": "^1.1.54",
22
22
  "animejs": "^3.2.1",
23
23
  "valaxy-addon-waline": "0.1.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/animejs": "^3.1.7",
27
- "valaxy": "0.14.27"
27
+ "valaxy": "0.14.29"
28
28
  }
29
29
  }
@@ -38,7 +38,7 @@ html.dark {
38
38
  }
39
39
 
40
40
  img {
41
- margin: auto;
41
+ margin: 0.5rem auto;
42
42
  }
43
43
 
44
44
  p {