Skip to content

Commit

Permalink
guides temp fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vikdiesel committed Oct 31, 2023
1 parent fffb685 commit 7893fac
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 23 deletions.
18 changes: 8 additions & 10 deletions .laravel-guide/resources/js/app.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import '../css/main.css'

import { createPinia } from 'pinia'
import { useDarkModeStore } from '@/stores/darkMode.js'
import { darkModeKey, styleKey } from '@/config.js'
// import { useDarkModeStore } from '@/stores/darkMode.js'
import { createApp, h } from 'vue'
import { createInertiaApp } from '@inertiajs/vue3'
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers'
Expand All @@ -28,12 +27,11 @@ createInertiaApp({
}
})

const darkModeStore = useDarkModeStore(pinia)
// const darkModeStore = useDarkModeStore(pinia)

/* Dark mode */
if (
(!localStorage[darkModeKey] && window.matchMedia('(prefers-color-scheme: dark)').matches) ||
localStorage[darkModeKey] === '1'
) {
darkModeStore.set(true)
}
// if (
// (!localStorage['darkMode'] && window.matchMedia('(prefers-color-scheme: dark)').matches) ||
// localStorage['darkMode'] === '1'
// ) {
// darkModeStore.set(true)
// }
26 changes: 13 additions & 13 deletions .nuxt-guide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ module.exports = {

```vue
<script setup>
import { useDarkModeStore } from '@/stores/darkMode.js'
import { darkModeKey } from '@/config.js'
// import { useDarkModeStore } from '@/stores/darkMode.js'
// import { darkModeKey } from '@/config.js'
useHead({
titleTemplate: (titleChunk) => {
Expand All @@ -96,19 +96,19 @@ useHead({
}
})
const darkModeStore = useDarkModeStore()
// const darkModeStore = useDarkModeStore()
const currentStoredDarkMode =
typeof localStorage !== 'undefined' && localStorage[darkModeKey] === '1'
// const currentStoredDarkMode =
// typeof localStorage !== 'undefined' && localStorage[darkModeKey] === '1'
if (
(!currentStoredDarkMode &&
typeof window !== 'undefined' &&
window.matchMedia('(prefers-color-scheme: dark)').matches) ||
currentStoredDarkMode
) {
darkModeStore.set(true)
}
// if (
// (!currentStoredDarkMode &&
// typeof window !== 'undefined' &&
// window.matchMedia('(prefers-color-scheme: dark)').matches) ||
// currentStoredDarkMode
// ) {
// darkModeStore.set(true)
// }
</script>
<template>
Expand Down

0 comments on commit 7893fac

Please sign in to comment.