/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, {type ReactNode} from 'react';
import clsx from 'clsx';
import {useBlogPost} from '@docusaurus/plugin-content-blog/client';
import {ThemeClassNames} from '@docusaurus/theme-common';
import EditMetaRow from '@theme/EditMetaRow';
import TagsListInline from '@theme/TagsListInline';
import ReadMoreLink from '@theme/BlogPostItem/Footer/ReadMoreLink';
export default function BlogPostItemFooter(): ReactNode {
const {metadata, isBlogPostPage} = useBlogPost();
const {
tags,
title,
editUrl,
hasTruncateMarker,
lastUpdatedBy,
lastUpdatedAt,
} = metadata;
// A post is truncated if it's in the "list view" and it has a truncate marker
const truncatedPost = !isBlogPostPage && hasTruncateMarker;
const tagsExists = tags.length > 0;
const renderFooter = tagsExists || truncatedPost || editUrl;
if (!renderFooter) {
return null;
}
// BlogPost footer - details view
if (isBlogPostPage) {
const canDisplayEditMetaRow = !!(editUrl || lastUpdatedAt || lastUpdatedBy);
return (
);
}
// BlogPost footer - list view
else {
return (
);
}
}