Update blog

This commit is contained in:
MD. Ariful Alam
2021-08-26 19:46:57 +06:00
parent 6dd27c6b07
commit f68e0ed9ea
2 changed files with 62 additions and 48 deletions

View File

@@ -1,17 +1,13 @@
import { getDevtoArticle, getMediumArticle } from "article-api"; import { getDevtoArticle, getMediumArticle } from "article-api";
import moment from "moment"; import moment from "moment";
import { useEffect, useState } from "react"; import { Fragment, useEffect, useState } from "react";
import { CgHashtag } from 'react-icons/cg'; import { CgHashtag } from 'react-icons/cg';
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
import config from "../config"; import config from "../config";
import { ga, skeleton } from "../helpers/utils"; import { ga, skeleton } from "../helpers/utils";
import LazyImage from "./LazyImage"; import LazyImage from "./LazyImage";
const Blog = () => { const displaySection = () => {
const [articles, setArticles] = useState(null);
const loading = useSelector(state => state.loading);
useEffect(() => {
if ( if (
typeof config.blog !== 'undefined' && typeof config.blog !== 'undefined' &&
typeof config.blog.source !== 'undefined' && typeof config.blog.source !== 'undefined' &&
@@ -19,6 +15,18 @@ const Blog = () => {
config.blog.source && config.blog.source &&
config.blog.username config.blog.username
) { ) {
return true;
} else {
return false;
}
}
const Blog = () => {
const [articles, setArticles] = useState(null);
const loading = useSelector(state => state.loading);
useEffect(() => {
if (displaySection()) {
if (config.blog.source === 'medium') { if (config.blog.source === 'medium') {
getMediumArticle({ getMediumArticle({
user: config.blog.username user: config.blog.username
@@ -149,6 +157,9 @@ const Blog = () => {
} }
return ( return (
<Fragment>
{
displaySection() && (
<div className="col-span-1 lg:col-span-2"> <div className="col-span-1 lg:col-span-2">
<div className="grid grid-cols-2 gap-6"> <div className="grid grid-cols-2 gap-6">
<div className="col-span-2"> <div className="col-span-2">
@@ -178,6 +189,9 @@ const Blog = () => {
</div> </div>
</div> </div>
) )
}
</Fragment>
)
} }
export default Blog; export default Blog;

View File

@@ -1,24 +1,14 @@
// config.js
module.exports = { module.exports = {
github: { github: {
username: 'arifszn', username: 'arifszn', // Your GitHub org/user name. (Required)
sortBy: 'stars', // stars | updated sortBy: 'stars', // stars | updated
limit: 8, // How many projects to display. limit: 8, // How many projects to display.
exclude: { exclude: {
forks: false, // forked projects will not be displayed if set to true forks: false, // Forked projects will not be displayed if set to true.
projects: [ 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: { social: {
linkedin: 'ariful-alam', linkedin: 'ariful-alam',
twitter: 'arif_swozon', twitter: 'arif_swozon',
@@ -27,7 +17,7 @@ module.exports = {
behance: '', behance: '',
medium: '', medium: '',
devto: '', devto: '',
website: 'https://www.arifszn.com', website: 'https://arifszn.github.io',
email: 'contact@arifszn.com' email: 'contact@arifszn.com'
}, },
skills: [ skills: [
@@ -77,6 +67,16 @@ module.exports = {
to: '2012' 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: { themeConfig: {
default: 'light', default: 'light',