Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: edit this page #356

Merged
merged 7 commits into from
May 31, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions src/defaultTheme/components/organisms/PageBottom.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
<template>
<div v-if="link" class="flex flex-col justify-between mt-8 mb-4 sm:flex-row">
<a
:href="link"
target="_blank"
rel="noopener"
class="flex items-center mb-2 text-sm sm:mb-0 font-base hover:underline dark:text-gray-400"
>
<div v-if="link" class="flex flex-col justify-between text-gray-500 dark:text-gray-500 mt-8 mb-4 sm:flex-row">
<a :href="link" target="_blank" rel="noopener" class="flex items-center mb-2 text-sm sm:mb-0 hover:underline">
<IconEdit class="w-3 h-3 mr-1" />
<span>
{{ $t('article.github') }}
</span>
</a>

<span class="flex items-center text-sm text-gray-500 font-base dark:text-gray-400">
<span class="flex items-center text-sm">
{{ $t('article.updatedAt') }} {{ $d(Date.parse(page.updatedAt), 'long') }}
</span>
</div>
Expand All @@ -31,17 +26,16 @@ export default defineComponent({
setup(props) {
const { $docus, $config } = useContext()

const settings = computed(() => $docus.settings)
const { value: settings } = computed(() => $docus.settings)

const link = computed(() => {
if (!settings.value.github) return

return [
$docus.repoUrl,
$docus.repoUrl.value,
'edit',
settings.value.github.branch,
settings.value.github.dir,
$config.contentDir,
settings.value.github.dir || $config.contentDir,
`${props.page.path}${props.page.extension}`.replace(/^\//g, '')
]
.filter(Boolean)
Expand Down