Skip to content

Commit bd6334a

Browse files
Logo links to Developer Portal
1 parent e897837 commit bd6334a

4 files changed

Lines changed: 37 additions & 5 deletions

File tree

vuepress/docs/.vuepress/config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export default defineUserConfig({
2525
],
2626

2727
theme: bccCodeTheme({
28-
home: '/',
2928
logoDark: 'logoWhite.png',
3029
logo: 'logo.png',
3130
repo: 'bcc-code',

vuepress/docs/.vuepress/styles/index.scss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ html.dark {
1414
}
1515

1616
// Overwrite default theme styles
17-
.site-name {
18-
display: none;
19-
}
20-
2117
.sidebar-heading {
2218
text-transform: capitalize;
2319
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<script setup lang="ts">
2+
import { ClientOnly, withBase } from '@vuepress/client'
3+
import { computed, h } from 'vue'
4+
import type { FunctionalComponent } from 'vue'
5+
import { useDarkMode, useThemeLocaleData } from '@vuepress/theme-default/lib/client/composables/index'
6+
7+
const themeLocale = useThemeLocaleData()
8+
const isDarkMode = useDarkMode()
9+
10+
const navbarBrandLogo = computed(() => {
11+
if (isDarkMode.value && themeLocale.value.logoDark !== undefined) {
12+
return themeLocale.value.logoDark
13+
}
14+
return themeLocale.value.logo
15+
})
16+
const NavbarBrandLogo: FunctionalComponent = () => {
17+
if (!navbarBrandLogo.value) return null
18+
const img = h('img', {
19+
class: 'logo',
20+
src: withBase(navbarBrandLogo.value),
21+
alt: "BCC",
22+
})
23+
if (themeLocale.value.logoDark === undefined) {
24+
return img
25+
}
26+
// wrap brand logo with <ClientOnly> to avoid ssr-mismatch
27+
// when using a different brand logo in dark mode
28+
return h(ClientOnly, () => img)
29+
}
30+
</script>
31+
32+
<template>
33+
<a href="https://developer.bcc.no">
34+
<NavbarBrandLogo />
35+
</a>
36+
</template>

vuepress/docs/.vuepress/theme/theme.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export const bccCodeTheme = (options: DefaultThemeOptions): Theme => {
1414

1515
alias: {
1616
'@theme/HomeFeatures.vue': path.resolve(__dirname, './components/HomeFeatures.vue'),
17+
'@theme/NavbarBrand.vue': path.resolve(__dirname, './components/NavbarBrand.vue'),
1718
},
1819
}
1920
};

0 commit comments

Comments
 (0)