mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 14:49:53 +00:00
e380a4d2b1
* Payment modal done * Refactor settings and added command support * Made sync operations more efficient * Sync button slightly more efficient * Remove Elm * Fixed Codemirror * Nunjucks 3.0 * Revert sourcemap change and some renaming * Some fixes for Config creation, and added name to resources * Set to new Insomnia URL * Some fixes
25 lines
557 B
JavaScript
25 lines
557 B
JavaScript
import React, {Component, PropTypes} from 'react';
|
|
|
|
class Nl2Br extends Component {
|
|
render () {
|
|
const {children, ...props} = this.props;
|
|
const text = children || '';
|
|
const lines = text.trim().split('\n');
|
|
return (
|
|
<p {...props}>{lines.map((l, i) => {
|
|
const trimmed = l.trim();
|
|
if (trimmed) {
|
|
const brs = i < lines.length - 1 ? [<br/>, <br/>] : [];
|
|
return [trimmed, ...brs];
|
|
} else {
|
|
return null;
|
|
}
|
|
})}</p>
|
|
);
|
|
}
|
|
}
|
|
|
|
Nl2Br.propTypes = {};
|
|
|
|
export default Nl2Br;
|