Skip to content

Commit

Permalink
remove stuff from translations
Browse files Browse the repository at this point in the history
  • Loading branch information
brc-dd committed Sep 16, 2022
1 parent fd0beb5 commit e1b0645
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 28 deletions.
8 changes: 7 additions & 1 deletion src/client/theme-default/components/VPDocAsideOutline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@ function handleClick({ target: el }: Event) {
<div class="outline-marker" ref="marker" />

<div class="outline-title">
{{ theme.translations?.outlineTitle || 'On this page' }}
{{
(typeof theme.outline === 'object' &&
!Array.isArray(theme.outline) &&
theme.outline.title) ||
theme.outlineTitle ||
'On this page'
}}
</div>

<nav aria-labelledby="doc-outline-aria-label">
Expand Down
4 changes: 2 additions & 2 deletions src/client/theme-default/components/VPDocFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ const showFooter = computed(() => {
<div v-if="control.prev || control.next" class="prev-next">
<div class="pager">
<a v-if="control.prev" class="pager-link prev" :href="normalizeLink(control.prev.link)">
<span class="desc">{{ theme.translations?.docFooter?.prev || 'Previous page' }}</span>
<span class="desc">{{ theme.docFooter?.prev || 'Previous page' }}</span>
<span class="title">{{ control.prev.text }} </span>
</a>
</div>
<div class="pager" :class="{ 'has-prev': control.prev }">
<a v-if="control.next" class="pager-link next" :href="normalizeLink(control.next.link)">
<span class="desc">{{ theme.translations?.docFooter?.next || 'Next page' }}</span>
<span class="desc">{{ theme.docFooter?.next || 'Next page' }}</span>
<span class="title">{{ control.next.text }}</span>
</a>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ onMounted(() => {

<template>
<p class="VPLastUpdated">
{{ theme.translations?.lastUpdatedText || 'Last updated' }}:
{{ theme.lastUpdatedText || 'Last updated' }}:
<time :datatime="isoDatetime">{{ datetime }}</time>
</p>
</template>
Expand Down
7 changes: 6 additions & 1 deletion src/client/theme-default/composables/outline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ export function getHeaders(pageOutline: DefaultTheme.Config['outline']) {

export function resolveHeaders(
headers: MenuItem[],
levelsRange: Exclude<DefaultTheme.Config['outline'], false> = 2
range?: Exclude<DefaultTheme.Config['outline'], false>
) {
const levelsRange =
(typeof range === 'object' && !Array.isArray(range)
? range.level
: range) || 2

const levels: [number, number] =
typeof levelsRange === 'number'
? [levelsRange, levelsRange]
Expand Down
71 changes: 48 additions & 23 deletions types/default-theme.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,17 @@ export namespace DefaultTheme {
*
* @default 2
*/
outline?: number | [number, number] | 'deep' | false
outline?: Outline | Outline['level'] | false

/**
* @deprecated
* Use `outline.title` instead.
*
* Custom outline title in the aside component.
*
* @default 'On this page'
*/
outlineTitle?: string

/**
* The nav items.
Expand All @@ -36,6 +46,18 @@ export namespace DefaultTheme {
*/
editLink?: EditLink

/**
* Set custom last updated text.
*
* @default 'Last updated'
*/
lastUpdatedText?: string

/**
* Set custom prev/next labels.
*/
docFooter?: DocFooter

/**
* The social links to be displayed at the end of the nav bar. Perfect for
* placing links to social services such as GitHub, Twitter, Facebook, etc.
Expand All @@ -61,28 +83,6 @@ export namespace DefaultTheme {
* Custom labels
*/
translations?: {
/**
* @default 'On this page'
*/
outlineTitle?: string

/**
* @default 'Last updated'
*/
lastUpdatedText?: string

docFooter?: {
/**
* @default 'Previous page'
*/
prev?: string

/**
* @default 'Next page'
*/
next?: string
}

/**
* @default 'Appearance'
*/
Expand Down Expand Up @@ -185,6 +185,24 @@ export namespace DefaultTheme {
text?: string
}

// prev-next -----------------------------------------------------------------

export interface DocFooter {
/**
* Custom label for previous page button.
*
* @default 'Previous page'
*/
prev?: string

/**
* Custom label for next page button.
*
* @default 'Next page'
*/
next?: string
}

// social link ---------------------------------------------------------------

export interface SocialLink {
Expand Down Expand Up @@ -223,6 +241,13 @@ export namespace DefaultTheme {
sponsor?: string
}

// outline -------------------------------------------------------------------

export interface Outline {
level?: number | [number, number] | 'deep'
title?: string
}

// algolia ------------------------------------------------------------------

/**
Expand Down

0 comments on commit e1b0645

Please sign in to comment.