fix(v2): make not clickable post title on post item page (#1962)

* fix(v2): make not clickable post title on post item page

* Refactor: move to props

* refactor: use explicit boolean value

* Revert last commit
This commit is contained in:
Alexey Pyltsyn 2019-11-14 01:15:41 +03:00 committed by GitHub
parent b1867e99be
commit ae1dec543e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View file

@ -15,7 +15,13 @@ import MDXComponents from '@theme/MDXComponents';
import styles from './styles.module.css'; import styles from './styles.module.css';
function BlogPostItem(props) { function BlogPostItem(props) {
const {children, frontMatter, metadata, truncated} = props; const {
children,
frontMatter,
metadata,
truncated,
isBlogPostPage = false,
} = props;
const {date, permalink, tags} = metadata; const {date, permalink, tags} = metadata;
const {author, authorURL, authorTitle, authorFBID, title} = frontMatter; const {author, authorURL, authorTitle, authorFBID, title} = frontMatter;
@ -45,7 +51,7 @@ function BlogPostItem(props) {
return ( return (
<header> <header>
<h1 className={classnames('margin-bottom--sm', styles.blogPostTitle)}> <h1 className={classnames('margin-bottom--sm', styles.blogPostTitle)}>
<Link to={permalink}>{title}</Link> {isBlogPostPage ? title : <Link to={permalink}>{title}</Link>}
</h1> </h1>
<div className="margin-bottom--sm"> <div className="margin-bottom--sm">
<time dateTime={date} className={styles.blogPostDate}> <time dateTime={date} className={styles.blogPostDate}>

View file

@ -20,7 +20,10 @@ function BlogPostPage(props) {
<div className="container margin-vert--xl"> <div className="container margin-vert--xl">
<div className="row"> <div className="row">
<div className="col col--8 col--offset-2"> <div className="col col--8 col--offset-2">
<BlogPostItem frontMatter={frontMatter} metadata={metadata}> <BlogPostItem
frontMatter={frontMatter}
metadata={metadata}
isBlogPostPage>
<BlogPostContents /> <BlogPostContents />
</BlogPostItem> </BlogPostItem>
{(metadata.nextItem || metadata.prevItem) && ( {(metadata.nextItem || metadata.prevItem) && (