Fix footer + Add Posts preview + fix header + about + blog + index page

This commit is contained in:
2020-10-29 23:35:18 +01:00
parent 9933439ee8
commit 181ea0bba3
52 changed files with 1514 additions and 219 deletions

View File

@@ -0,0 +1,34 @@
import Vue from 'vue'
import colorSchemeComponent from './color-scheme'
Vue.component('ColorScheme', colorSchemeComponent)
export default function (ctx, inject) {
const preference = 'system'
const colorMode = {
preference,
value: preference,
unknown: true,
forced: false
}
if (ctx.route.matched[0]) {
const pageColorMode = ctx.route.matched[0].components.default.options.colorMode
if (pageColorMode && pageColorMode !== 'system') {
colorMode.value = pageColorMode
colorMode.forced = true
ctx.app.head.bodyAttrs = ctx.app.head.bodyAttrs || {}
ctx.app.head.bodyAttrs['data-color-mode-forced'] = pageColorMode
} else if (pageColorMode === 'system') {
console.warn('You cannot force the colorMode to system at the page level.')
}
}
ctx.beforeNuxtRender(({ nuxtState }) => {
nuxtState.colorMode = colorMode
})
inject('colorMode', colorMode)
}