storybookjs / addon-jsx

This Storybook addon show you the JSX / template of the story
https://storybooks-addon-jsx.netlify.com
MIT License
235 stars 32 forks source link

prevent break line of array props value #31

Open gabrielrtakeda opened 6 years ago

gabrielrtakeda commented 6 years ago

Hi! Is there any way to prevent the react-element-to-jsx-string to breaking lines on an array value props? Bellow follows an example:

Input code

<Row>
  <Cell>
    <Block>[1, 2, 3, 4, 6, 12]</Block>
  </Cell>

  <Cell size={[8, 2, 3, 4, 6, 6]}>
    <Block>[8, 2, 3, 4, 6, 6]</Block>
  </Cell>

  <Cell size={[null, null, null, null, null, 6]}>
    <Block>[1, 2, 3, 4, 6, 6]</Block>
  </Cell>

  <Cell size={[2]}>
    <Block>[2, 2, 3, 4, 6, 12]</Block>
  </Cell>
</Row>

Output formatted code

<Row>
  <Cell>
    <Block>
      [1, 2, 3, 4, 6, 12]
    </Block>
  </Cell>
  <Cell
    size={[
      8,
      2,
      3,
      4,
      6,
      6
    ]}
  >
    <Block>
      [8, 2, 3, 4, 6, 6]
    </Block>
  </Cell>
  <Cell
    size={[
      null,
      null,
      null,
      null,
      null,
      6
    ]}
  >
    <Block>
      [1, 2, 3, 4, 6, 6]
    </Block>
  </Cell>
  <Cell
    size={[
      2
    ]}
  >
    <Block>
      [2, 2, 3, 4, 6, 12]
    </Block>
  </Cell>
</Row>
hipstersmoothie commented 5 years ago

This seems to be a problem upstream with https://github.com/algolia/react-element-to-jsx-string/