-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
127 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<template> | ||
<p v-if="hasLastUpdated" class="last-updated"> | ||
<span class="prefix">{{ prefix }}:</span> | ||
<span class="datetime">{{ datetime }}</span> | ||
</p> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent, computed } from 'vue' | ||
import { useSiteDataByRoute, usePageData } from 'vitepress' | ||
export default defineComponent({ | ||
setup() { | ||
const site = useSiteDataByRoute() | ||
const page = usePageData() | ||
const hasLastUpdated = computed(() => { | ||
const lu = site.value.themeConfig.lastUpdated | ||
return lu !== undefined && lu !== false | ||
}) | ||
const prefix = computed(() => { | ||
const p = site.value.themeConfig.lastUpdated | ||
return p === true ? 'Last Updated' : p | ||
}) | ||
const datetime = computed(() => { | ||
return new Date(page.value.lastUpdated).toLocaleString('en-US') | ||
}) | ||
return { | ||
hasLastUpdated, | ||
prefix, | ||
datetime | ||
} | ||
} | ||
}) | ||
</script> | ||
|
||
<style scoped> | ||
.last-updated { | ||
display: inline-block; | ||
margin: 0; | ||
line-height: 1.4; | ||
font-size: .9rem; | ||
color: var(--c-text-light); | ||
} | ||
@media (min-width: 960px) { | ||
.last-updated { | ||
font-size: 1rem; | ||
} | ||
} | ||
.prefix { | ||
display: inline-block; | ||
font-weight: 500; | ||
} | ||
.datetime { | ||
display: inline-block; | ||
margin-left: 6px; | ||
font-weight: 400; | ||
} | ||
</style> |
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,49 @@ | ||
<template> | ||
<footer class="page-footer"> | ||
<div class="edit"> | ||
<EditLink /> | ||
</div> | ||
<div class="updated"> | ||
<LastUpdated /> | ||
</div> | ||
</footer> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent } from 'vue' | ||
import EditLink from './EditLink.vue' | ||
import LastUpdated from './LastUpdated.vue' | ||
export default defineComponent({ | ||
components: { | ||
EditLink, | ||
LastUpdated | ||
} | ||
}) | ||
</script> | ||
|
||
<style scoped> | ||
.page-footer { | ||
padding-top: 1rem; | ||
padding-bottom: 1rem; | ||
overflow: auto; | ||
} | ||
@media (min-width: 960px) { | ||
.page-footer { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
} | ||
} | ||
.updated { | ||
padding-top: 4px; | ||
} | ||
@media (min-width: 960px) { | ||
.updated { | ||
padding-top: 0; | ||
} | ||
} | ||
</style> |
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