Fixed link generator name and theme query string

This commit is contained in:
DenverCoder1
2020-10-26 04:37:49 +02:00
parent 25a1bf4110
commit 12279914f1
3 changed files with 41 additions and 17 deletions
+10 -2
View File
@@ -13,11 +13,19 @@ const githubStatsStylingQueryString = options => {
return query_string
}
const streakStatsStylingQueryString = options => {
const params = {
...(options.theme && options.theme !== "none") && { theme: options.theme },
}
const query_string = Object.entries(params).map(([key, value]) => `${key}=${value}`).join("&")
return query_string
}
export const githubStatsLinkGenerator = ({github, options}) =>
`https://github-readme-stats.vercel.app/api?username=${github}&${githubStatsStylingQueryString(options)}`
export const topLanguagesLinkGenerator = ({github, options}) =>
`https://github-readme-stats.vercel.app/api/top-langs?username=${github}&${githubStatsStylingQueryString(options)}&layout=compact`
export const githubStreakLinkGenerator = ({github, options}) =>
`https://github-readme-streak-stats.herokuapp.com/?user=${github}`
export const streakStatsLinkGenerator = ({github, options}) =>
`https://github-readme-streak-stats.herokuapp.com/?user=${github}&${streakStatsStylingQueryString(options)}`