{"size": 683, "ext": "js", "max_stars_repo_path": "ui_framework/doc_site/src/components/guide_sandbox/guide_sandbox_code_toggle.js", "max_stars_repo_name": "GitHubShark39/kibana.elastic.redvulture.github.io", "max_stars_repo_stars_event_min_datetime": "2016-12-17T07:34:09.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-25T16:38:27.000Z", "max_issues_repo_path": "ui_framework/doc_site/src/components/guide_sandbox/guide_sandbox_code_toggle.js", "max_issues_repo_name": "GitHubShark39/kibana.elastic.redvulture.github.io", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "ui_framework/doc_site/src/components/guide_sandbox/guide_sandbox_code_toggle.js", "max_forks_repo_name": "GitHubShark39/kibana.elastic.redvulture.github.io", "max_forks_repo_forks_event_min_datetime": "2019-05-23T05:09:12.000Z", "max_forks_repo_forks_event_max_datetime": "2019-06-03T05:47:23.000Z"}
{"max_stars_count": 2, "max_issues_count": null, "max_forks_count": 2, "avg_line_length": 22.0322580645, "max_line_length": 69, "alphanum_fraction": 0.6778916545}
import PropTypes from 'prop-types';
import React, { Component } from 'react';

export class GuideSandboxCodeToggle extends Component {
  constructor(props) {
    super(props);
    this.onClickSource = this.onClickSource.bind(this);
  }

  onClickSource() {
    this.props.openCodeViewer(this.props.source, this.props.title);
  }

  render() {
    return (
      <button
        className="guideSandboxCodeToggle guideSection__sourceButton"
        onClick={this.onClickSource}
      >
        <span className="fa fa-code" />
      </button>
    );
  }
}

GuideSandboxCodeToggle.propTypes = {
  source: PropTypes.array,
  title: PropTypes.string,
  openCodeViewer: PropTypes.func,
};
