feat: init theming in empty layout
This commit is contained in:
@@ -1,3 +1,44 @@
|
|||||||
<template>
|
<template>
|
||||||
<Nuxt />
|
<Nuxt />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import {
|
||||||
|
useContext,
|
||||||
|
onBeforeMount,
|
||||||
|
watch,
|
||||||
|
defineComponent,
|
||||||
|
} from "@nuxtjs/composition-api"
|
||||||
|
import { useSetting } from "~/newstore/settings"
|
||||||
|
|
||||||
|
function updateThemes() {
|
||||||
|
const { $colorMode } = useContext() as any
|
||||||
|
|
||||||
|
// Apply theme updates
|
||||||
|
const themeColor = useSetting("THEME_COLOR")
|
||||||
|
const bgColor = useSetting("BG_COLOR")
|
||||||
|
const fontSize = useSetting("FONT_SIZE")
|
||||||
|
|
||||||
|
// Initially apply
|
||||||
|
onBeforeMount(() => {
|
||||||
|
document.documentElement.setAttribute("data-accent", themeColor.value)
|
||||||
|
$colorMode.preference = bgColor.value
|
||||||
|
document.documentElement.setAttribute("data-font-size", fontSize.value)
|
||||||
|
})
|
||||||
|
|
||||||
|
// Listen for updates
|
||||||
|
watch(themeColor, () =>
|
||||||
|
document.documentElement.setAttribute("data-accent", themeColor.value)
|
||||||
|
)
|
||||||
|
watch(bgColor, () => ($colorMode.preference = bgColor.value))
|
||||||
|
watch(fontSize, () =>
|
||||||
|
document.documentElement.setAttribute("data-font-size", fontSize.value)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
setup() {
|
||||||
|
updateThemes()
|
||||||
|
},
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|||||||
@@ -23,18 +23,32 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script lang="ts">
|
||||||
import { ref } from "@nuxtjs/composition-api"
|
import { defineComponent } from "@nuxtjs/composition-api"
|
||||||
import { initializeFirebase } from "~/helpers/fb"
|
import { initializeFirebase } from "~/helpers/fb"
|
||||||
import { currentUser$ } from "~/helpers/fb/auth"
|
import { currentUser$ } from "~/helpers/fb/auth"
|
||||||
import { useReadonlyStream } from "~/helpers/utils/composables"
|
import { useReadonlyStream } from "~/helpers/utils/composables"
|
||||||
initializeFirebase()
|
|
||||||
|
|
||||||
const currentUser = useReadonlyStream(currentUser$, null)
|
export default defineComponent({
|
||||||
|
layout: "empty",
|
||||||
// const loading = ref(false)
|
setup() {
|
||||||
// const error = ref(null)
|
return {
|
||||||
const showLogin = ref(false)
|
currentUser: useReadonlyStream(currentUser$, null),
|
||||||
|
}
|
||||||
const joinTeam = () => {}
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
showLogin: false,
|
||||||
|
// loading : false
|
||||||
|
// error : null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeMount() {
|
||||||
|
initializeFirebase()
|
||||||
|
},
|
||||||
|
async mounted() {},
|
||||||
|
methods: {
|
||||||
|
joinTeam() {},
|
||||||
|
},
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user