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

Tweak the design of the navbar and footer #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions lib/client/components/Navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
</RouterLink>
</span>

<NavbarSearch />

<div class="navbar-links-wrapper" :style="linksWrapperStyle">
<slot name="before" />

Expand All @@ -32,8 +34,6 @@
<slot name="after" />

<ToggleDarkModeButton v-if="enableDarkMode" />

<NavbarSearch />
</div>
</header>
</template>
Expand Down
29 changes: 15 additions & 14 deletions lib/client/components/PageMeta.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,25 @@
<NavLink class="meta-item-label" :item="editNavLink" />
</div>

<div v-if="lastUpdated" class="meta-item last-updated">
<span class="meta-item-label">{{ themeLocale.lastUpdatedText }}: </span>
<ClientOnly>
<span class="meta-item-info">{{ lastUpdated }}</span>
</ClientOnly>
</div>
<div v-if="contributors && contributors.length" class="meta-item contributors">
<span class="meta-item-label">{{ themeLocale.contributorsText }}: </span>
<span class="meta-item-label">{{ contributors.length }} {{ pluralize('themeLocale.contributorsText', contributors.length)} }} </span>
<span class="meta-item-info">
<template v-for="(contributor, index) in contributors" :key="index">
<span v-if="contributor.email" class="contributor" :title="`email: ${contributor.email}`">
{{ contributor.name }}
</span>
<span v-if="!contributor.email" class="contributor">
{{ contributor.name }}
</span>
<a class="contributor-link" :href="`https://github.com/${contributor.name}`">
<span :aria-label="`${contributor.name}`">
<img :src="`https://github.com/${contributor.name}.png?size=40`" :alt="`${contributor.name}`" size="20" :title="`${contributor.name}`" width="20" height="20">
</span>
</a>
<template v-if="index !== contributors.length - 1">, </template>
</template>
</span>
</div>

<div v-if="lastUpdated" class="meta-item last-updated">
<ClientOnly>
<span class="meta-item-info">{{ themeLocale.lastUpdatedText }} by {{ contributors[0] || {} }} on {{ format(new Date(lastUpdated), 'MMMM d, y') }}</span>
</ClientOnly>
</div>
</footer>
</template>

Expand All @@ -43,6 +42,8 @@ import type {
import { useThemeLocaleData } from '../composables'
import { resolveEditLink } from '../utils'
import NavLink from './NavLink.vue'
import pluralize from 'pluralize'
import {format} from 'date-fns'

const useEditNavLink = (): ComputedRef<null | NavLinkType> => {
const themeLocale = useThemeLocaleData()
Expand Down Expand Up @@ -77,7 +78,7 @@ const useEditNavLink = (): ComputedRef<null | NavLinkType> => {
if (!editLink) return null

return {
text: editLinkText ?? 'Edit this page',
text: 'Edit this page on GitHub',
link: editLink,
}
})
Expand Down
22 changes: 18 additions & 4 deletions lib/client/styles/page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@

.meta-item-label {
font-weight: 500;
color: var(--c-text-lighter);
color: var(--c-text-accent);
}

.meta-item-info {
font-weight: 400;
color: var(--c-text-quote);
color: var(--c-text);
}

.icon.outbound {
color: var(--c-text-accent);
}
}

Expand All @@ -32,8 +36,18 @@
margin-right: 0.25rem;
}

.last-updated {
float: right;
.last-updated .meta-item-info {
color: var(--c-text-quote);
font-size: 14px;
margin-top: 4px;
}

.contributor-link {
display: inline-block;
overflow: hidden;
line-height: 1;
vertical-align: middle;
border-radius: 50%;
}
}

Expand Down
4 changes: 2 additions & 2 deletions lib/node/utils/assignDefaultLocaleOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ const defaultLocaleOptions = {
editLink: true,
editLinkText: 'Edit this page',
lastUpdated: true,
lastUpdatedText: 'Last Updated',
lastUpdatedText: 'Last updated',
contributors: true,
contributorsText: 'Contributors',
contributorsText: 'contributors',
// 404 page messages
notFound: [
`There's nothing here.`,
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
"@vuepress/shared": "2.0.0-beta.25",
"@vuepress/utils": "2.0.0-beta.25",
"@vueuse/core": "^6.0.0",
"date-fns": "^2.28.0",
"pluralize": "^8.0.0",
"sass": "^1.38.0",
"sass-loader": "^12.1.0",
"vue": "^3.2.3",
Expand Down