<commit_before>React    = require 'react'
_ = require 'underscore'
{default: Courses} = require '../models/courses-map'
{ChapterSectionMixin} = require 'shared'
Icon = require './icon'
{default: BrowseTheBook} = require './buttons/browse-the-book'


RelatedContentLink = React.createClass

  propTypes:
    courseId: React.PropTypes.string.isRequired
    content: React.PropTypes.arrayOf(
      React.PropTypes.shape(
        title: React.PropTypes.string.isRequired
        chapter_section: React.PropTypes.array.isRequired
      ).isRequired
    ).isRequired

  mixins: [ChapterSectionMixin]

  render: ->
    return null if _.isEmpty(@props.content)

    <div className='related-content-link'>
      <span className="preamble">Comes from </span>
      {for content, i in @props.content
        section = @sectionFormat(content.chapter_section)
        <BrowseTheBook
          key={i} unstyled
          page={section}
          course={Courses.get(@props.courseId)}
          tabIndex={-1}
        >
          <span className="part">
            <span className="section">{section} </span>
            <span className="title">{content.title}</span>
          </span>
        </BrowseTheBook>}
    </div>

module.exports = RelatedContentLink
<commit_msg>page prop was renamed to chapterSection<commit_after>React    = require 'react'
_ = require 'underscore'
{default: Courses} = require '../models/courses-map'
{ChapterSectionMixin} = require 'shared'
Icon = require './icon'
{default: BrowseTheBook} = require './buttons/browse-the-book'


RelatedContentLink = React.createClass

  propTypes:
    courseId: React.PropTypes.string.isRequired
    content: React.PropTypes.arrayOf(
      React.PropTypes.shape(
        title: React.PropTypes.string.isRequired
        chapter_section: React.PropTypes.array.isRequired
      ).isRequired
    ).isRequired

  mixins: [ChapterSectionMixin]

  render: ->
    return null if _.isEmpty(@props.content)

    <div className='related-content-link'>
      <span className="preamble">Comes from </span>
      {for content, i in @props.content
        section = @sectionFormat(content.chapter_section)
        <BrowseTheBook
          key={i} unstyled
          chapterSection={section}
          course={Courses.get(@props.courseId)}
          tabIndex={-1}
        >
          <span className="part">
            <span className="section">{section} </span>
            <span className="title">{content.title}</span>
          </span>
        </BrowseTheBook>}
    </div>

module.exports = RelatedContentLink

{'fraction_non_alphanumeric': 0.12549019607843137, 'fraction_numerical': 0.000784313725490196, 'mean_word_length': 2.888719512195122, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 29, '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': '362829', 'n_tokens_mistral': 760, 'n_tokens_neox': 741, 'n_words': 147}