<commit_before>var React = require("react");
var PropTypes = React.PropTypes;
var map = require("lodash/map");
var assign = require("lodash/assign");
var BackgroundRect = require("./BackgroundRect.jsx");
var SvgText = require("./SvgText.jsx");

var SvgWrapper = React.createClass({

	propTypes: {
		outerDimensions: PropTypes.object,
		metadata: PropTypes.object,
		margin: PropTypes.object,
		displayConfig: PropTypes.object
	},

	_createTitle: function() {
		return (
			<SvgText
				text={this.props.metadata.title}
				key="title"
				translate={[5, 10]}
				align="top"
				className="svg-text-title"
			/>
		);
	},

	_getYOffset: function(props) {
		if (props.metadata.title.length > 0) {
			return props.displayConfig.afterTitle;
		} else {
			return 0;
		}
	},

	render: function() {
		var props = this.props;
		var children = React.Children.toArray(props.children);
		var childrenWithProps = map(children, function(child) {
			var childProps = assign({}, props, child.props);
			return React.cloneElement(child, childProps);
		});

		var translate = [
			props.displayConfig.margin.left,
			props.displayConfig.margin.top + this._getYOffset(props)
		];

		return (
			<svg width={props.outerDimensions.width} height={props.outerDimensions.height}>
				<BackgroundRect dimensions={props.outerDimensions} />
				{this._createTitle()}
				<g
					className="chart-margin"
					transform={"translate(" + translate + ")"}
				>
					{props.children}
				</g>
			</svg>
		);
	}

});

module.exports = SvgWrapper;
<commit_msg>add default outer margin to svg title<commit_after>var React = require("react");
var PropTypes = React.PropTypes;
var BackgroundRect = require("./BackgroundRect.jsx");
var SvgText = require("./SvgText.jsx");

var SvgWrapper = React.createClass({

	propTypes: {
		outerDimensions: PropTypes.object,
		metadata: PropTypes.object,
		margin: PropTypes.object,
		displayConfig: PropTypes.object
	},

	_createTitle: function(props) {
		return (
			<SvgText
				text={props.metadata.title}
				key="title"
				translate={[
					props.displayConfig.margin.left,
					props.displayConfig.margin.top
				]}
				align="top"
				className="svg-text-title"
			/>
		);
	},

	_getYOffset: function(props) {
		if (props.metadata.title.length > 0) {
			return props.displayConfig.afterTitle;
		} else {
			return 0;
		}
	},

	render: function() {
		var props = this.props;

		// Add to the chart margin if title is present
		var translate = [
			props.displayConfig.margin.left,
			props.displayConfig.margin.top + this._getYOffset(props)
		];

		return (
			<svg width={props.outerDimensions.width} height={props.outerDimensions.height}>
				<BackgroundRect dimensions={props.outerDimensions} />
				{this._createTitle(props)}
				<g className="chart-margin" transform={"translate(" + translate + ")"} >
					{props.children}
				</g>
			</svg>
		);
	}

});

module.exports = SvgWrapper;

{'fraction_non_alphanumeric': 0.14586206896551723, 'fraction_numerical': 0.002413793103448276, 'mean_word_length': 3.6865912762520194, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, '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': '7541053', 'n_tokens_mistral': 1101, 'n_tokens_neox': 937, 'n_words': 177}