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,24 +1,32 @@
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 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 Blog = () => {
const [articles, setArticles] = useState(null); const [articles, setArticles] = useState(null);
const loading = useSelector(state => state.loading); const loading = useSelector(state => state.loading);
useEffect(() => { useEffect(() => {
if ( if (displaySection()) {
typeof config.blog !== 'undefined' &&
typeof config.blog.source !== 'undefined' &&
typeof config.blog.username !== 'undefined' &&
config.blog.source &&
config.blog.username
) {
if (config.blog.source === 'medium') { if (config.blog.source === 'medium') {
getMediumArticle({ getMediumArticle({
user: config.blog.username user: config.blog.username
@@ -149,34 +157,40 @@ const Blog = () => {
} }
return ( return (
<div className="col-span-1 lg:col-span-2"> <Fragment>
<div className="grid grid-cols-2 gap-6"> {
<div className="col-span-2"> displaySection() && (
<div className="card compact bg-base-100 shadow-sm"> <div className="col-span-1 lg:col-span-2">
<div className="card-body"> <div className="grid grid-cols-2 gap-6">
<ul className="menu row-span-3 bg-base-100 text-base-content"> <div className="col-span-2">
<li> <div className="card compact bg-base-100 shadow-sm">
<div className="pb-0-important mx-4 flex items-center justify-between"> <div className="card-body">
<h5 className="card-title"> <ul className="menu row-span-3 bg-base-100 text-base-content">
{ <li>
(loading || !articles) ? skeleton({ width: 'w-28', height: 'h-8' }) : ( <div className="pb-0-important mx-4 flex items-center justify-between">
<span className="opacity-70">Recent Posts</span> <h5 className="card-title">
) {
} (loading || !articles) ? skeleton({ width: 'w-28', height: 'h-8' }) : (
</h5> <span className="opacity-70">Recent Posts</span>
)
}
</h5>
</div>
</li>
</ul>
</div> </div>
</li> </div>
</ul> </div>
<div className="col-span-2">
<div className="grid grid-cols-1 gap-6">
{(loading || !articles) ? renderSkeleton() : renderArticles()}
</div>
</div>
</div> </div>
</div> </div>
</div> )
<div className="col-span-2"> }
<div className="grid grid-cols-1 gap-6"> </Fragment>
{(loading || !articles) ? renderSkeleton() : renderArticles()}
</div>
</div>
</div>
</div>
) )
} }

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',