Refactor utils.jsx

This commit is contained in:
Ariful Alam 2022-07-18 12:40:51 +06:00
parent caff2ce258
commit 66bd370f34

View File

@ -136,11 +136,11 @@ export const sanitizeConfig = (config) => {
return {
github: {
username: config.github.username,
sortBy: config.github.sortBy || 'stars',
limit: config.github.limit || 8,
username: config?.github?.username || '',
sortBy: config?.github?.sortBy || 'stars',
limit: config?.github?.limit || 8,
exclude: {
forks: config?.github?.exclude?.forks,
forks: config?.github?.exclude?.forks || false,
projects: config?.github?.exclude?.projects || [],
},
},
@ -174,8 +174,9 @@ export const sanitizeConfig = (config) => {
},
themeConfig: {
defaultTheme: config?.themeConfig?.defaultTheme || themes[0],
disableSwitch: config?.themeConfig?.disableSwitch,
respectPrefersColorScheme: config?.themeConfig?.respectPrefersColorScheme,
disableSwitch: config?.themeConfig?.disableSwitch || false,
respectPrefersColorScheme:
config?.themeConfig?.respectPrefersColorScheme || false,
themes: themes,
customTheme: customTheme,
},