1
- import type { StarlightPlugin } from '@astrojs/starlight/types' ;
1
+ import type { StarlightPlugin , StarlightUserConfig } from '@astrojs/starlight/types' ;
2
2
3
3
const packageName = '@multitheftauto/starlight-theme-mtasa' ;
4
4
5
+ type SocialLinksSchema = NonNullable < StarlightUserConfig [ 'social' ] > ;
6
+
7
+ function mergeWithSocialDefaults ( social : SocialLinksSchema , defaults : SocialLinksSchema ) : SocialLinksSchema {
8
+ const filtered = defaults . filter ( d => ! social . some ( s => s . label === d . label ) ) ;
9
+ return [ ...social , ...filtered ] ;
10
+ }
11
+
5
12
export default function mtasaStarlightThemePlugin ( ) : StarlightPlugin {
6
13
return {
7
14
name : 'starlight-theme-mtasa' ,
@@ -18,14 +25,13 @@ export default function mtasaStarlightThemePlugin(): StarlightPlugin {
18
25
Header : `${ packageName } /Header.astro` ,
19
26
...config . components ?? { } ,
20
27
} ,
21
- social : [
28
+ social : mergeWithSocialDefaults ( config . social ?? [ ] , [
22
29
{ icon : 'github' , label : 'GitHub' , href : 'https://github.com/multitheftauto/' } ,
23
30
{ icon : 'discord' , label : 'Discord' , href : 'https://discord.com/invite/mtasa' } ,
24
31
{ icon : 'youtube' , label : 'YouTube' , href : 'https://youtube.com/user/mtaqa' } ,
25
32
{ icon : 'twitch' , label : 'Twitch' , href : 'https://twitch.tv/mtaqa' } ,
26
33
{ icon : 'x.com' , label : 'X (Twitter)' , href : 'https://x.com/mtaqa' } ,
27
- ...config . social ?? [ ] ,
28
- ] ,
34
+ ] ) ,
29
35
} )
30
36
}
31
37
} ,
0 commit comments