Skip to content

Commit 3ebf444

Browse files
committed
feat: add core module config
1 parent cca81f8 commit 3ebf444

File tree

2 files changed

+148
-4
lines changed

2 files changed

+148
-4
lines changed

src/module.ts

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,62 @@
11
import { addPlugin, createResolver, defineNuxtModule } from '@nuxt/kit'
22

3-
// Module options TypeScript interface definition
4-
export interface ModuleOptions {}
3+
// Types
4+
import type { ModuleOptions } from './types'
55

66
export default defineNuxtModule<ModuleOptions>({
77
meta: {
88
name: 'nuxtify-core',
99
configKey: 'nuxtifyCore',
10+
compatibility: {
11+
nuxt: '>=3.16.0',
12+
bridge: false,
13+
},
14+
},
15+
defaults: {
16+
// Brand
17+
brand: {
18+
name: 'nuxtify-core',
19+
domain: '',
20+
tagline: '',
21+
logo: {
22+
lightUrl: '',
23+
darkUrl: '',
24+
width: 200,
25+
mobileWidth: 150,
26+
},
27+
},
28+
29+
// Policies
30+
policies: {
31+
privacyUrl: '/privacy',
32+
termsUrl: '/terms',
33+
},
34+
35+
// Announcement
36+
announcement: {
37+
show: false,
38+
message: '',
39+
buttonText: '',
40+
buttonUrl: '',
41+
},
42+
43+
// Credits
44+
credits: {
45+
creator: {
46+
name: '',
47+
domain: '',
48+
},
49+
prependText: '',
50+
appendText: '',
51+
showPoweredBy: true,
52+
},
53+
54+
// Email
55+
email: {
56+
general: '',
57+
support: '',
58+
},
1059
},
11-
// Default configuration options of the Nuxt module
12-
defaults: {},
1360
setup(_options, _nuxt) {
1461
const resolver = createResolver(import.meta.url)
1562

src/types.ts

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
interface BrandOptions {
2+
/**
3+
* The name of the brand.
4+
*
5+
* @default "nuxtify-core"
6+
*/
7+
name?: string
8+
/**
9+
* The domain of the brand.
10+
*
11+
* @default ""
12+
*/
13+
domain?: string
14+
/**
15+
* The tagline of the brand.
16+
*
17+
* @default ""
18+
*/
19+
tagline?: string
20+
/**
21+
* The logo of the brand.
22+
*/
23+
logo?: {
24+
/**
25+
* The URL of the light logo. Recommended 5:1 aspect ratio (e.g. 400 x 80 px).
26+
*
27+
* @default ""
28+
*/
29+
lightUrl?: string
30+
/**
31+
* The URL of the dark logo. Recommended 5:1 aspect ratio (e.g. 400 x 80 px).
32+
*
33+
* @default ""
34+
*/
35+
darkUrl?: string
36+
/**
37+
* The width of the logo.
38+
*
39+
* @default 200
40+
*/
41+
width?: number
42+
/**
43+
* The width of the logo on mobile.
44+
*
45+
* @default 150
46+
*/
47+
mobileWidth?: number
48+
}
49+
}
50+
51+
interface PoliciesOptions {
52+
privacyUrl: string
53+
termsUrl: string
54+
}
55+
56+
export interface ModuleOptions {
57+
/**
58+
* Brand options
59+
*/
60+
brand?: BrandOptions
61+
62+
/**
63+
* Policies options
64+
*/
65+
policies?: PoliciesOptions
66+
67+
/**
68+
* Announcement banner options
69+
*/
70+
announcement?: {
71+
show?: boolean
72+
message?: string
73+
buttonText?: string
74+
buttonUrl?: string
75+
}
76+
77+
/**
78+
* Credits options
79+
*/
80+
credits?: {
81+
creator?: {
82+
name?: string
83+
domain?: string
84+
}
85+
prependText?: string
86+
appendText?: string
87+
showPoweredBy?: boolean
88+
}
89+
90+
/**
91+
* Email options
92+
*/
93+
email?: {
94+
general?: string
95+
support?: string
96+
}
97+
}

0 commit comments

Comments
 (0)