import PropTypes from 'prop-types'; import React, { Component, Fragment } from 'react'; import { FormattedMessage } from 'react-intl'; import { NavLink } from 'react-router-dom'; export default class SectionHeadline extends Component { static propTypes = { timelineId: PropTypes.string.isRequired, to: PropTypes.string.isRequired, pinned: PropTypes.bool.isRequired, onlyMedia: PropTypes.bool.isRequired, onClick: PropTypes.func, }; shouldComponentUpdate (nextProps) { return ( this.props.onlyMedia !== nextProps.onlyMedia || this.props.pinned !== nextProps.pinned || this.props.to !== nextProps.to || this.props.timelineId !== nextProps.timelineId ); } handleClick = e => { const { onClick } = this.props; if (typeof onClick === 'function') { e.preventDefault(); onClick.call(this, e); } } render () { const { timelineId, to, pinned, onlyMedia } = this.props; return (
{pinned ? ( ) : ( )}
); } }