<commit_before>import React, { PropTypes } from 'react'
import { injectIntl, intlShape } from 'react-intl'
import Constants from '../constants/Constants'

class MediaType extends React.Component {
  renderFormats (mediaType, maybeFormats) {
    const formats = maybeFormats || []
    const filtered = formats.filter(format => {
      if (mediaType === 'http://data.deichman.no/mediaType#Book' && (formats.length === 1 && formats[ 0 ] === 'http://data.deichman.no/format#Book')) {
        return false
      } else {
        return !(mediaType === 'http://data.deichman.no/mediaType#ComicBook' && (formats.length === 1 && formats[ 0 ] === 'http://data.deichman.no/format#Book'))
      }
    })
    return <p>
      {filtered.map(format => {
        return <span key={format}>{this.props.intl.formatMessage({ id: format })} &nbsp;</span>
      })}
    </p>
  }

  render () {
    const mediaType = this.props.mediaType
    return (
      <div key={mediaType.uri} className="entry-content-icon-single">
        <img src={`/images/icon-${Constants.mediaTypeIcons[ mediaType.uri ]}.svg`} />
        <p><strong>{this.props.intl.formatMessage({ id: mediaType.uri })}</strong></p>
        <div>{this.renderFormats(mediaType.uri, mediaType.formats)}</div>
      </div>
    )
  }
}

MediaType.propTypes = {
  mediaType: PropTypes.object.isRequired,
  intl: intlShape.isRequired
}

export default injectIntl(MediaType)
<commit_msg>Hide media type icon from screen readers etc.<commit_after>import React, { PropTypes } from 'react'
import { injectIntl, intlShape } from 'react-intl'
import Constants from '../constants/Constants'

class MediaType extends React.Component {
  renderFormats (mediaType, maybeFormats) {
    const formats = maybeFormats || []
    const filtered = formats.filter(format => {
      if (mediaType === 'http://data.deichman.no/mediaType#Book' && (formats.length === 1 && formats[ 0 ] === 'http://data.deichman.no/format#Book')) {
        return false
      } else {
        return !(mediaType === 'http://data.deichman.no/mediaType#ComicBook' && (formats.length === 1 && formats[ 0 ] === 'http://data.deichman.no/format#Book'))
      }
    })
    return <p>
      {filtered.map(format => {
        return <span key={format}>{this.props.intl.formatMessage({ id: format })} &nbsp;</span>
      })}
    </p>
  }

  render () {
    const mediaType = this.props.mediaType
    return (
      <div key={mediaType.uri} className="entry-content-icon-single">
        <img src={`/images/icon-${Constants.mediaTypeIcons[ mediaType.uri ]}.svg`} aria-hidden="true"/>
        <p><strong>{this.props.intl.formatMessage({ id: mediaType.uri })}</strong></p>
        <div>{this.renderFormats(mediaType.uri, mediaType.formats)}</div>
      </div>
    )
  }
}

MediaType.propTypes = {
  mediaType: PropTypes.object.isRequired,
  intl: intlShape.isRequired
}

export default injectIntl(MediaType)

{'fraction_non_alphanumeric': 0.17128027681660898, 'fraction_numerical': 0.002768166089965398, 'mean_word_length': 3.3278443113772456, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1368433', 'n_tokens_mistral': 941, 'n_tokens_neox': 934, 'n_words': 174}