Display empty blog state

This commit is contained in:
Ariful Alam 2022-04-24 14:16:49 +06:00
parent 0f3becb8f9
commit 035eb95723

View File

@ -3,6 +3,7 @@ import { Fragment, useEffect, useState } from 'react';
import { ga, skeleton } from '../../helpers/utils';
import LazyImage from '../lazy-image';
import PropTypes from 'prop-types';
import { AiOutlineContainer } from 'react-icons/ai';
import { getDevPost, getMediumPost } from '@arifszn/blog-js';
const displaySection = (blog) => {
@ -98,8 +99,7 @@ const Blog = ({ loading, blog, googleAnalytics }) => {
};
const renderArticles = () => {
return (
articles &&
return articles && articles.length ? (
articles.slice(0, blog.limit).map((article, index) => (
<a
className="card shadow-lg compact bg-base-100 cursor-pointer"
@ -169,6 +169,11 @@ const Blog = ({ loading, blog, googleAnalytics }) => {
</div>
</a>
))
) : (
<div className="text-center mb-6">
<AiOutlineContainer className="mx-auto h-12 w-12 opacity-30" />
<p className="mt-1 text-sm opacity-50">No recent post</p>
</div>
);
};