Skip to content
This repository has been archived by the owner on Nov 10, 2017. It is now read-only.

Improved rendering of props #24

Merged
merged 2 commits into from
Jun 29, 2016

Conversation

kesne
Copy link
Contributor

@kesne kesne commented Jun 28, 2016

This improves how props are rendered, with the intent of solving #22.

  • Wraps all required values with {} in the jsx. Strings remain un-wrapped.
  • Boolean true values will now have the ={true} omitted to prefer the JSX shorthand.
  • Doesn't limit the number of props that can be displayed.
  • If there are more than 3 props, they are split across multiple lines.
  • Space between props is actual whitespace, so copying and pasting should be possible!

@arunoda
Copy link
Contributor

arunoda commented Jun 28, 2016

Thanks @kesne.
@roonyh could you have a look at this?

@Maxhodges
Copy link
Contributor

maybe also take a look at d26243d

We propose adding a class to proptables to allow easier custom styles

=
<span style={propValueStyle}><PropVal val={props[name]} /></span>
{/* Use implicit true: */}
{!props[name] || typeof props[name] !== 'boolean' && (
Copy link
Contributor

@roonyh roonyh Jun 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we add parenthesis (!props[name] || typeof props[name] !== 'boolean') && ( ?
Because if someone explicitly specified false as the value of a boolean prop this renders it as implicit true.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@roonyh
Copy link
Contributor

roonyh commented Jun 28, 2016

@kesne This is great!! Could you check my one comment? Thanks!

@kesne
Copy link
Contributor Author

kesne commented Jun 28, 2016

@roonyh Updated!

@roonyh roonyh merged commit 3b111ba into storybook-eol:master Jun 29, 2016
@roonyh
Copy link
Contributor

roonyh commented Jun 29, 2016

@kesne Thanks! 👍

@thani-sh
Copy link
Contributor

Published v3.0.9

@kesne kesne mentioned this pull request Jul 7, 2016
@kesne kesne deleted the jgens/fix-pro-rendering branch July 7, 2016 18:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants