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

when <RowDefinition> children contains <ColumnDefinition> and an arra… #837

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

JaosnHsieh
Copy link

@JaosnHsieh JaosnHsieh commented Oct 14, 2018

Griddle major version

1.13.1

Changes proposed in this pull request

Wish could have props.Children is and array of at the same time.

Why these changes are made

#836

Are there tests?

One story added as test

Copy link
Contributor

@dahlbyk dahlbyk left a comment

Choose a reason for hiding this comment

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

Thanks for this contribution! Could you add an example of this feature to the Storybook to confirm it works as expected?

previous[current.props.id] = {order: offset + i, ...current.props};
if(Array.isArray(current)){
current.forEach((c)=>{
previous[c.props.id] = {order: offset + i, ...c.props};
Copy link
Contributor

Choose a reason for hiding this comment

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

This will end up producing multiple columns that share an order value, which can produce unexpected behavior.

@@ -25,7 +25,14 @@ export function getColumnProperties(rowProperties, allColumns=[]) {
// build one object that contains all of the column properties keyed by id
children.reduce((previous, current, i) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would a simpler solution be to _.flatten(children).reduce(...) here?

Copy link
Author

Choose a reason for hiding this comment

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

it's better!

@JaosnHsieh
Copy link
Author

JaosnHsieh commented Dec 21, 2018

just updated to current version and added sotrybook example

@JaosnHsieh JaosnHsieh force-pushed the fix/836_columnDefIsArray branch from 0a4bd1b to 00f3f79 Compare January 21, 2019 14:15
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.

2 participants