docbrown/app/javascript/articles/components/ContentTitle.jsx
Akshay Mahajan ff918daa20
Remove flare tag from title and hightlight it within the tags row (#10528)
* Remove flare tag from title and hightlight it within the tags row

* wrap flare tag # in a span with class crayons-tag__prefix

* updated buildArticleHTML.js to show flare tag in the tags row

* updated _single_story.html.erb to show flare tag in the tags row

* fixed missing opening tag

* removed crayons-story__flare-tag class and containers

* added .crayons-story__flare-tag back to stories.scss for search results

* added check for undefined tagList in buildArticleHTML.js
2020-10-15 16:09:14 +02:00

28 lines
848 B
JavaScript

import { h } from 'preact';
import { articlePropTypes } from '../../common-prop-types';
export const ContentTitle = ({ article }) => (
<h2 className="crayons-story__title">
<a href={article.path} id={`article-link-${article.id}`}>
{article.class_name === 'PodcastEpisode' && (
<span className="crayons-story__flare-tag">podcast</span>
)}
{article.class_name === 'User' && (
<span
className="crayons-story__flare-tag"
style={{ background: '#5874d9', color: 'white' }}
>
person
</span>
)}
{/* eslint-disable-next-line react/no-danger */}
<span dangerouslySetInnerHTML={{ __html: filterXSS(article.title) }} />
</a>
</h2>
);
ContentTitle.propTypes = {
article: articlePropTypes.isRequired,
};
ContentTitle.displayName = 'ContentTitle';