diff --git a/src/components/Blog.js b/src/components/Blog.js index 6b20f79..3237b70 100644 --- a/src/components/Blog.js +++ b/src/components/Blog.js @@ -1,24 +1,32 @@ import { getDevtoArticle, getMediumArticle } from "article-api"; import moment from "moment"; -import { useEffect, useState } from "react"; +import { Fragment, useEffect, useState } from "react"; import { CgHashtag } from 'react-icons/cg'; import { useSelector } from "react-redux"; import config from "../config"; import { ga, skeleton } from "../helpers/utils"; import LazyImage from "./LazyImage"; +const displaySection = () => { + if ( + typeof config.blog !== 'undefined' && + typeof config.blog.source !== 'undefined' && + typeof config.blog.username !== 'undefined' && + config.blog.source && + config.blog.username + ) { + return true; + } else { + return false; + } +} + const Blog = () => { const [articles, setArticles] = useState(null); const loading = useSelector(state => state.loading); useEffect(() => { - if ( - typeof config.blog !== 'undefined' && - typeof config.blog.source !== 'undefined' && - typeof config.blog.username !== 'undefined' && - config.blog.source && - config.blog.username - ) { + if (displaySection()) { if (config.blog.source === 'medium') { getMediumArticle({ user: config.blog.username @@ -149,34 +157,40 @@ const Blog = () => { } return ( -
-
-
-
-
-
    -
  • -
    -
    - { - (loading || !articles) ? skeleton({ width: 'w-28', height: 'h-8' }) : ( - Recent Posts - ) - } -
    + + { + displaySection() && ( +
    +
    +
    +
    +
    +
      +
    • +
      +
      + { + (loading || !articles) ? skeleton({ width: 'w-28', height: 'h-8' }) : ( + Recent Posts + ) + } +
      +
      +
    • +
    -
  • -
+
+
+
+
+ {(loading || !articles) ? renderSkeleton() : renderArticles()} +
+
-
-
-
- {(loading || !articles) ? renderSkeleton() : renderArticles()} -
-
- - + ) + } + ) } diff --git a/src/config.js b/src/config.js index 66cb1fc..7d3a95b 100644 --- a/src/config.js +++ b/src/config.js @@ -1,24 +1,14 @@ +// config.js module.exports = { github: { - username: 'arifszn', + username: 'arifszn', // Your GitHub org/user name. (Required) sortBy: 'stars', // stars | updated limit: 8, // How many projects to display. exclude: { - forks: false, // forked projects will not be displayed if set to true - projects: [ - - ] + forks: false, // Forked projects will not be displayed if set to true. + projects: [] // These projects will not be displayed. example: ['my-project1', 'my-project2'] } }, - blog: { - source: 'dev.to', // medium | dev.to - username: 'arifszn', - limit: 5 // How many posts to display. Max is 10. - }, - googleAnalytics: { - id: 'G-WLLB5E14M6', - // id: 'G-XXXXXXXXXX' // GA3 tracking id/GA4 tag id - }, social: { linkedin: 'ariful-alam', twitter: 'arif_swozon', @@ -27,7 +17,7 @@ module.exports = { behance: '', medium: '', devto: '', - website: 'https://www.arifszn.com', + website: 'https://arifszn.github.io', email: 'contact@arifszn.com' }, skills: [ @@ -77,6 +67,16 @@ module.exports = { to: '2012' } ], + blog: { + // Display blog posts from your medium or dev.to account. (Optional) + source: 'dev.to', // medium | dev.to + username: 'arifszn', + limit: 5 // How many posts to display. Max is 10. + }, + googleAnalytics: { + // GA3 tracking id/GA4 tag id + id: 'G-WLLB5E14M6' // UA-XXXXXXXXX-X | G-XXXXXXXXXX + }, themeConfig: { default: 'light',