diff --git a/src/components/addons.js b/src/components/addons.js index 0cc8fd4..06d05b2 100644 --- a/src/components/addons.js +++ b/src/components/addons.js @@ -150,6 +150,12 @@ const Addons = props => { theme: "" }); + useEffect(() => { + setGithubStatsOptions({ + ...props.data.githubStatsOptions + }) + }, [props.data.githubStatsOptions]) + const blogPostPorkflow = () => { let payload = { dev: { diff --git a/src/components/markdown.js b/src/components/markdown.js index 7fc96a7..faf3139 100644 --- a/src/components/markdown.js +++ b/src/components/markdown.js @@ -1,6 +1,8 @@ import React from "react" import { isMediumUsernameValid } from "../utils/validation" import { icons, skills, skillWebsites } from "../constants/skills" +import { githubStatsLinkGenerator } from "../utils/link-generators" + const Markdown = props => { const Title = props => { @@ -124,14 +126,10 @@ const Markdown = props => { return "" } const GitHubStats = props => { - let link = - "https://github-readme-stats.vercel.app/api?username=" + - props.github + - "&show_icons=true" if (props.show) { return ( <> - {`

 ${props.github}

`} + {`

 ${props.github}

`}

@@ -497,10 +495,10 @@ const Markdown = props => { ) } - export default Markdown diff --git a/src/components/markdownPreview.js b/src/components/markdownPreview.js index c4eba86..ab62d8e 100644 --- a/src/components/markdownPreview.js +++ b/src/components/markdownPreview.js @@ -1,5 +1,6 @@ import React from "react" import { icons, skills, skillWebsites } from "../constants/skills" +import { githubStatsLinkGenerator } from "../utils/link-generators" const MarkdownPreview = props => { const TitlePreview = props => { @@ -267,19 +268,12 @@ const MarkdownPreview = props => { } return null } - const GitHubStatsPreview = ({github, options, show })=> { - const params = { - username: github, - show_icons: true, - ...options.theme && { theme: options.theme } - } - const query_string = Object.entries(params).map(([key, value]) => `${key}=${value}`).join("&") - const link = `https://github-readme-stats.vercel.app/api?${query_string}` + const GitHubStatsPreview = ({github, options, show })=> { if (show) { return (
- {props.github} + {github}
) }