1- import type { StarlightPlugin } from '@astrojs/starlight/types' ;
1+ import type { StarlightPlugin , StarlightUserConfig } from '@astrojs/starlight/types' ;
22
33const packageName = '@multitheftauto/starlight-theme-mtasa' ;
44
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+
512export default function mtasaStarlightThemePlugin ( ) : StarlightPlugin {
613 return {
714 name : 'starlight-theme-mtasa' ,
@@ -18,14 +25,13 @@ export default function mtasaStarlightThemePlugin(): StarlightPlugin {
1825 Header : `${ packageName } /Header.astro` ,
1926 ...config . components ?? { } ,
2027 } ,
21- social : [
28+ social : mergeWithSocialDefaults ( config . social ?? [ ] , [
2229 { icon : 'github' , label : 'GitHub' , href : 'https://github.com/multitheftauto/' } ,
2330 { icon : 'discord' , label : 'Discord' , href : 'https://discord.com/invite/mtasa' } ,
2431 { icon : 'youtube' , label : 'YouTube' , href : 'https://youtube.com/user/mtaqa' } ,
2532 { icon : 'twitch' , label : 'Twitch' , href : 'https://twitch.tv/mtaqa' } ,
2633 { icon : 'x.com' , label : 'X (Twitter)' , href : 'https://x.com/mtaqa' } ,
27- ...config . social ?? [ ] ,
28- ] ,
34+ ] ) ,
2935 } )
3036 }
3137 } ,
0 commit comments