<commit_before>import React from 'react';
import { Link } from 'react-router';
import classNames from 'classnames';
import * as utils from '../utils';

export default class Demo extends React.Component {
  constructor(props) {
    super(props);

    this.state = {
      codeExpand: false,
    };
  }

  componentWillReceiveProps(nextProps) {
    if (nextProps.expand === undefined) return;

    this.setState({
      codeExpand: nextProps.expand,
    });
  }

  handleCodeExapnd = () => {
    this.setState({ codeExpand: !this.state.codeExpand });
  }

  render() {
    const { id, className, meta, intro, preview, style, src,
            highlightedCode, highlightedStyle, pathname } = this.props;
    const codeExpand = this.state.codeExpand;
    const codeBoxClass = classNames({
      'code-box': true,
      [className]: className,
      expand: codeExpand,
    });
    const introChildren = utils.jsonmlToComponent(pathname, ['div'].concat(intro));
    return (
      <section className={codeBoxClass} id={id}>
        <section className="code-box-demo">
          {
            meta.iframe ?
              <iframe src={src} /> :
              preview
          }
          {
            !!style ?
              <style dangerouslySetInnerHTML={{ __html: style }} /> :
              null
          }
        </section>
        <section className="code-box-meta markdown">
          <div className="code-box-title">
            <Link to={{ pathname, query: { scrollTo: id } }}>
              {meta.title}
            </Link>
          </div>
          {introChildren}<commit_msg>site: fix iframe<commit_after>import React from 'react';
import { Link } from 'react-router';
import classNames from 'classnames';
import * as utils from '../utils';

const isLocal = location.port;

export default class Demo extends React.Component {
  constructor(props) {
    super(props);

    this.state = {
      codeExpand: false,
    };
  }

  componentWillReceiveProps(nextProps) {
    if (nextProps.expand === undefined) return;

    this.setState({
      codeExpand: nextProps.expand,
    });
  }

  handleCodeExapnd = () => {
    this.setState({ codeExpand: !this.state.codeExpand });
  }

  render() {
    const { id, className, meta, intro, preview, style, src,
            highlightedCode, highlightedStyle, pathname } = this.props;
    const codeExpand = this.state.codeExpand;
    const codeBoxClass = classNames({
      'code-box': true,
      [className]: className,
      expand: codeExpand,
    });
    const introChildren = utils.jsonmlToComponent(pathname, ['div'].concat(intro));
    return (
      <section className={codeBoxClass} id={id}>
        <section className="code-box-demo">
          {
            meta.iframe ?
              <iframe src={isLocal ? src : src.replace('./_site', '')} /> :
              preview
          }
          {
            !!style ?
              <style dangerouslySetInnerHTML={{ __html: style }} /> :
              null
          }
        </section>
        <section className="code-box-meta markdown">
          <div className="code-box-title">
            <Link to={{ pathname, query: { scrollTo: id } }}>
              {meta.title}
            </Link>
          </div>
          {introChildren}
{'fraction_non_alphanumeric': 0.13325107958050586, 'fraction_numerical': 0.0, 'mean_word_length': 2.157740993184031, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 25, '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': '2336331', 'n_tokens_mistral': 932, 'n_tokens_neox': 909, 'n_words': 208}