start putting things in better spots

This commit is contained in:
Mars 2024-08-27 00:03:24 -04:00
parent 48d073a1de
commit 28fc33cd82
Signed by: pupbrained
GPG key ID: 874E22DF2F9DFCB5
13 changed files with 69 additions and 71 deletions

51
app.vue
View file

@ -1,59 +1,10 @@
<template> <template>
<select <NavBar />
v-model='selectedFont'
:disabled='loading'
@change='updateFont'
>
<option
v-for='(value, key) in fonts'
:key='key'
:value='key'
>
{{ value.name }}
</option>
</select>
<select
v-model='selectedTheme'
:disabled='loading'
@change='updateTheme'
>
<option
v-for='(value, key) in themes'
:key='key'
:value='key'
>
{{ value.name }}
</option>
</select>
<NuxtRouteAnnouncer /> <NuxtRouteAnnouncer />
<NuxtPage /> <NuxtPage />
</template> </template>
<script setup> <script setup>
import { themes } from '~/types/themes'
import { fonts } from '~/types/fonts'
const { theme, setTheme } = useTheme()
const selectedTheme = ref('')
const { font, setFont } = useFont()
const selectedFont = ref('')
const loading = ref(true)
onMounted(() => {
selectedTheme.value = theme.value
selectedFont.value = font.value
loading.value = false
})
const updateTheme = () => {
setTheme(selectedTheme.value)
}
const updateFont = () => {
setFont(selectedFont.value)
}
useHead({ useHead({
bodyAttrs: { bodyAttrs: {
class: 'bg-bg', class: 'bg-bg',

View file

@ -0,0 +1,28 @@
<template>
<select
v-model='selectedFont'
:disabled='loading'
@change='updateFont'
>
<option
v-for='(value, key) in fonts'
:key='key'
:value='key'
>
{{ value.name }}
</option>
</select>
</template>
<script setup lang="ts">
const { font, setFont } = useFont()
const selectedFont = ref('')
const loading = ref(true)
onMounted(() => {
selectedFont.value = font.value
loading.value = false
})
const updateFont = () => setFont(selectedFont.value)
</script>

4
components/NavBar.vue Normal file
View file

@ -0,0 +1,4 @@
<template>
<FontSwitcher />
<ThemeSwitcher />
</template>

View file

@ -0,0 +1,30 @@
<template>
<select
v-model='selectedTheme'
:disabled='loading'
@change='updateTheme'
>
<option
v-for='(value, key) in themes'
:key='key'
:value='key'
>
{{ value.name }}
</option>
</select>
</template>
<script setup lang="ts">
const { theme, setTheme } = useTheme()
const selectedTheme = ref('')
const loading = ref(true)
onMounted(() => {
selectedTheme.value = theme.value
loading.value = false
})
const updateTheme = () => {
setTheme(selectedTheme.value)
}
</script>

View file

@ -1,5 +1,4 @@
import { ref, onMounted } from 'vue' import { ref, onMounted } from 'vue'
import { fonts } from '~/types/fonts'
const fontNames = Object.keys(fonts) const fontNames = Object.keys(fonts)

View file

@ -1,5 +1,4 @@
import { ref, onMounted } from 'vue' import { ref, onMounted } from 'vue'
import { themes } from '~/types/themes'
const themeNames = Object.keys(themes) const themeNames = Object.keys(themes)

View file

@ -1,10 +1,6 @@
// @ts-check // @ts-check
import withNuxt from './.nuxt/eslint.config.mjs' import withNuxt from './.nuxt/eslint.config.mjs'
export default withNuxt( export default withNuxt().overrideRules({
// Your custom configs here 'vue/html-quotes': ['error', 'single'],
).override('nuxt/stylistic', {
rules: {
'vue/html-quotes': ['error', 'single'],
},
}) })

View file

@ -1,4 +1,4 @@
import { fonts } from './types/fonts' import { fonts } from './utils/fonts'
export default defineNuxtConfig({ export default defineNuxtConfig({
compatibilityDate: '2024-04-03', compatibilityDate: '2024-04-03',

View file

@ -4,9 +4,7 @@ const route = useRoute()
<template> <template>
<div> <div>
<h1> <h1>Nuxt Routing set up successfully!</h1>
Nuxt Routing set up successfully!
</h1>
<p>Current route: {{ route.path }}</p> <p>Current route: {{ route.path }}</p>
<a <a
href='https://nuxt.com/docs/getting-started/routing' href='https://nuxt.com/docs/getting-started/routing'

View file

@ -1,14 +1,7 @@
<script setup lang="ts">
const route = useRoute()
</script>
<template> <template>
<div> <div>
<h1 c-text> <h1 c-text>
Nuxt Routing set up successfully! hi im mard
</h1> </h1>
<p c-subtext>
Current route: {{ route.path }}
</p>
</div> </div>
</template> </template>

View file

@ -10,7 +10,7 @@ import {
} from 'unocss' } from 'unocss'
import type { Theme } from 'unocss/preset-uno' import type { Theme } from 'unocss/preset-uno'
import presetTheme from 'unocss-preset-theme' import presetTheme from 'unocss-preset-theme'
import { themesWithoutName } from '~/types/themes' import { themesWithoutName } from '~/utils/themes'
export default defineConfig<Theme>({ export default defineConfig<Theme>({
theme: themesWithoutName['catppuccin-mocha'], theme: themesWithoutName['catppuccin-mocha'],