docbrown/app/javascript/articles/components/ContentTitle.jsx
Marcy Sutton b04b5bcb57
Headings and alt text roundup (#11721)
* Adjust heading order

No skipping levels, adding an h1 for the homepage

* Add missing image alt text

* Update after PR review

* Update test snapshot

Co-authored-by: rhymes <rhymes@hey.com>
2020-12-04 09:41:45 -05:00

28 lines
848 B
JavaScript

import { h } from 'preact';
import { articlePropTypes } from '../../common-prop-types';
export const ContentTitle = ({ article }) => (
<h3 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>
</h3>
);
ContentTitle.propTypes = {
article: articlePropTypes.isRequired,
};
ContentTitle.displayName = 'ContentTitle';