Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List item prop renderers #221

Merged
merged 1 commit into from
Apr 26, 2016
Merged

Conversation

levithomason
Copy link
Member

@levithomason levithomason commented Apr 26, 2016

Breakout of #206, makes fixes to the list item component.

Prop renderers

Our propRenderers util gives us consistent intelligent handling of prop values. In this case, icon and image props. You can pass either a string or a component. See link above.

In the case of a string value, a component will be created for you. icon='user' would create an <Icon /> with the user class. image='//placehold.it would create an <Image /> with the src attr set to the placehold.it url.

@levithomason levithomason force-pushed the feature/listitem-prop-renderers branch from e3343e5 to ee05a32 Compare April 26, 2016 20:25
header && <div key='header' className='header'>{header}</div>,
_description && <div key='description' className='description'>{_description}</div>,
] : (
_description
Copy link
Member Author

@levithomason levithomason Apr 26, 2016

Choose a reason for hiding this comment

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

Do not add description div if there is no header, it breaks middle aligned content.

@levithomason levithomason force-pushed the feature/listitem-prop-renderers branch from ee05a32 to 945b2bd Compare April 26, 2016 20:27
@levithomason levithomason changed the title List item keys and prop renderers List item prop renderers Apr 26, 2016
@levithomason levithomason mentioned this pull request Apr 26, 2016
<div className='header'>{header}</div>
{description && <div className='description'>{description}</div>}
</div>
const media = iconPropRenderer(icon) || imagePropRenderer(image)
Copy link
Member Author

Choose a reason for hiding this comment

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

🎉

@eanplatter
Copy link
Contributor

Lgtm 🍂

@kyleturco
Copy link
Contributor

Good to mine eyes 🌍

@levithomason levithomason merged commit cebdfdd into master Apr 26, 2016
@levithomason levithomason deleted the feature/listitem-prop-renderers branch April 26, 2016 20:39
@levithomason levithomason mentioned this pull request May 24, 2016
24 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants