import React, { PropTypes } from 'react';

const Text = ({ lineBreak, style, text, ...props }) => {
  const styleLine = { marginTop: lineBreak };

  return (
    <div {...props} style={style}>
      {`${text}`.split('\n').map((t, i) => (
        <div key={i} style={i ? styleLine : undefined}>{t}</div>
      ))}
    </div>
  );
};

Text.defaultProps = {
  lineBreak: 10,
  style: {},
  text: ''
};

Text.propTypes = {
  lineBreak: PropTypes.number,
  style: PropTypes.object,
  text: PropTypes.string.isRequired
};

export default Text;

@@ -33,17 +33,16 @@
  'react'
-;
 %0A%0Aconst 
@@ -140,73 +140,63 @@
 ak %7D
-;%0A
 %0A  
-return (%0A    %3Cdiv %7B...props%7D style=%7Bstyle%7D%3E%0A      %7B%60$%7Btext%7D%60
+const children = /%5Cn/.test(text)%0A    ? text%0A        
 .spl
@@ -203,16 +203,25 @@
 it('%5Cn')
+%0A        
 .map((t,
@@ -230,18 +230,8 @@
 ) =%3E
- (%0A       
  %3Cdi
@@ -287,17 +287,83 @@
 div%3E
+)
 %0A    
-  ))
+: text%0A%0A  return (%0A    %3Cdiv %7B...props%7D style=%7Bstyle%7D%3E%0A      %7Bchildren
 %7D%0A  
@@ -378,12 +378,10 @@
 %0A  )
-;
 %0A%7D
-;
 %0A%0ATe
@@ -440,19 +440,19 @@
 text: ''
+,
 %0A%7D
-;
 %0A%0AText.p
@@ -561,11 +561,11 @@
 ired
+,
 %0A%7D
-;
 %0A%0Aex
@@ -585,6 +585,5 @@
 Text
-;
 %0A

simplify text output if there are no new lines