addon-jsx icon indicating copy to clipboard operation
addon-jsx copied to clipboard

JSX formatting for component props

Open petermikitsh opened this issue 4 years ago • 2 comments

I have some components that accept a React.Node for props. Example (body, footer, etc):

Screen Shot 2020-06-15 at 5 58 34 PM

It would be nice if they followed the 2-space indentation. If maintainers agree with this change, any pointers on implementing it would be appreciated-- thanks!

petermikitsh avatar Jun 16 '20 01:06 petermikitsh

Expected formatting would be:

<Card
  body={
    <div>
      <Typography color="textSecondary" gutterBottom>
        Word of the Day
      </Typography>
      <Typography component="h2" variant="h5">
        benevolent
      </Typography>
      <Typography color="textSecondary">adjective</Typography>
      <Typography component="p" variant="body2">
        well meaning and kindly.
      </Typography>
    </div>
  }
  footer={
    <Button tooltip="" variant="text">
      Learn More
    </Button>
  }
  header="Trivial Knowledge"
/>

petermikitsh avatar Jun 16 '20 01:06 petermikitsh

Def down for better formatting. maybe it's just getting lost somewhere along the way.

Only tip for dev is let's avoid adding prettier as a dep. Had to remove that and do the formatting myself in storybook-pretty-props because prettier/standalone is 1mb

hipstersmoothie avatar Jun 16 '20 01:06 hipstersmoothie