/** * External dependencies */ import { useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { Pagination, EmptyContent } from '@woocommerce/components'; /** * Internal dependencies */ import { CollapsibleCard, ReadBlogMessage } from '~/marketing/components'; import { PlaceholderPostTile } from './PlaceholderPostTile'; import { PostTile } from './PostTile'; import { useBlogPosts } from './useBlogPosts'; import './LearnMarketing.scss'; const BLOG_POST_CATEGORY = 'marketing'; const PER_PAGE = 2; export const LearnMarketing = () => { const [ page, setPage ] = useState( 1 ); const { isLoading, error, posts } = useBlogPosts( BLOG_POST_CATEGORY ); /** * Renders card footer. * * - If loading is in progress, it returns a loading placeholder in the card footer. * - If there is an error or there are no posts, there will be no card footer. * - Returns a pagination component in the card footer for paging through the posts. */ const renderFooter = () => { if ( isLoading ) { return (
); } if ( error || ! posts || posts.length === 0 ) { return null; } return (