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

Feature/add sd item #65

Merged
merged 14 commits into from
Oct 20, 2015
Merged

Feature/add sd item #65

merged 14 commits into from
Oct 20, 2015

Conversation

athurman
Copy link
Contributor

2 New SD components for the Semantic UI Item view:

An item view presents large collections of site content for display

EDIT

PR also addresses GH Issue #68

static propTypes = {
children: PropTypes.node,
className: PropTypes.string,
description: PropTypes.node,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need to add utility for adding warning if children exists.

@levithomason levithomason mentioned this pull request Oct 20, 2015
1 task
@eanplatter
Copy link
Contributor

🍂

},
};

export default customPropTypes;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

new utility to be used with customPropType validation and checking.

if (props[propName] && props[exclusiveProp]) {
throw new Error(
`\`${componentName}\` should only have one of type \`${propName}\` or \`${exclusiveProp}\` not both.`
);
Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't think of throwing error messages with ticks. nice!

@eanplatter
Copy link
Contributor

🍂

'item',
);
return (
<div {...this.props} className={classes}>
Copy link
Member

Choose a reason for hiding this comment

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

Component props used for Stardust purposes should be removed from this.props before spreading. Only the user's props should be spread. Since this component takes in:

children
className
description
extra
heading
image
meta

We should remove those props before spreading them onto the Item. Otherwise, we'll be spreading components and other unintended things:

let props = _.clone(this.props);
delete props.children;
delete props.className;
delete props.description;
delete props.extra;
delete props.heading;
delete props.image;
delete props.meta;

// then

<div {...props} ...

Thinking about this, I believe we should always remove static PropTypes props, except for static defaultProps before spreading. This way we only spread "extra" user defined props and defaultProps the user didn't specify. Linking #69 spreadable props util here for this reference.

For now, add the clone/delete step before spreading.

import faker from 'faker';

describe('Item', () => {
it('has children', () => {
Copy link
Member

Choose a reason for hiding this comment

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

Small semantic request here. This test isn't testing that Item has children but that Item renders children.

@levithomason
Copy link
Member

Good to merge after hitting the last to comments:
https://github.com/TechnologyAdvice/stardust/pull/65/files#r42529042
https://github.com/TechnologyAdvice/stardust/pull/65/files#r42529646

Also, can close #68. Nice work on that, and bundling the <Items /> component.

👍 ⚡

athurman added a commit that referenced this pull request Oct 20, 2015
@athurman athurman merged commit 1bea785 into master Oct 20, 2015
@athurman athurman deleted the feature/add-sd-item branch October 20, 2015 18:43
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