File tree Expand file tree Collapse file tree 4 files changed +77
-5
lines changed Expand file tree Collapse file tree 4 files changed +77
-5
lines changed Original file line number Diff line number Diff line change 11<script setup lang="ts">
2- const nuxtifyConfig = useAppConfig (). nuxtify
2+ const nuxtifyConfig = useNuxtifyConfig ()
33 </script >
44
55<template >
6- <div >
6+ <h1 >
77 nuxtify-pages module playground!
8- <v-btn >
9- Test
10- </v-btn >
8+ </h1 >
9+
10+ <v-btn >
11+ Test Button
12+ </v-btn >
13+
14+ <div >
15+ <AppLogo />
1116 </div >
1217
1318 <h2 >nuxtifyConfig</h2 >
Original file line number Diff line number Diff line change 11import {
22 defineNuxtModule ,
3+ addComponentsDir ,
4+ addImportsDir ,
35 addPlugin ,
46 createResolver ,
57 installModule ,
@@ -44,6 +46,12 @@ export default defineNuxtModule<ModuleOptions>({
4446 ..._options ,
4547 } )
4648
49+ // Add auto-imports
50+ addComponentsDir ( {
51+ path : resolver . resolve ( 'runtime/components' ) ,
52+ } )
53+ addImportsDir ( resolver . resolve ( 'runtime/composables' ) )
54+
4755 // Do not add the extension since the `.ts` will be transpiled to `.mjs` after `npm run prepack`
4856 addPlugin ( resolver . resolve ( './runtime/plugin' ) )
4957 } ,
Original file line number Diff line number Diff line change 1+ <script setup lang="ts">
2+ import { useAppConfig } from ' #app'
3+ import { useDisplay , computed } from ' #imports'
4+
5+ // Props
6+ const props = defineProps ({
7+ dark: {
8+ type: Boolean ,
9+ default: false ,
10+ },
11+ width: {
12+ type: Number ,
13+ default: undefined ,
14+ },
15+ })
16+
17+ // App state
18+ const nuxtifyConfig = useAppConfig ().nuxtify
19+ const { smAndDown } = useDisplay ()
20+
21+ // Image URL logic
22+ // Set default to the light image url
23+ let imageUrl = nuxtifyConfig .brand .logo .lightUrl
24+
25+ // If it's dark theme logo and there's a dark image url, use that
26+ if (props .dark && nuxtifyConfig .brand .logo .darkUrl ) {
27+ imageUrl = nuxtifyConfig .brand .logo .darkUrl
28+ }
29+
30+ // Image width logic
31+ const width = computed (() => {
32+ if (props .width ) {
33+ return props .width
34+ }
35+ else {
36+ return smAndDown .value
37+ ? nuxtifyConfig .brand .logo .mobileWidth
38+ : nuxtifyConfig .brand .logo .width
39+ }
40+ })
41+ </script >
42+
43+ <template >
44+ <v-img
45+ v-if =" imageUrl"
46+ :width
47+ :src =" imageUrl"
48+ :alt =" `${nuxtifyConfig.brand.name} logo`"
49+ />
50+ <span
51+ v-else
52+ :class =" `text-subtitle-1 text-sm-h6 ${dark ? '' : 'text-primary'}`"
53+ >
54+ {{ nuxtifyConfig.brand.name }}
55+ </span >
56+ </template >
Original file line number Diff line number Diff line change 1+ import { useAppConfig } from '#app'
2+
3+ export const useNuxtifyConfig = ( ) => useAppConfig ( ) . nuxtify
You can’t perform that action at this time.
0 commit comments