Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

chore(shorthands): allow arrays as shorthand value #996

Merged

Conversation

mnajdova
Copy link
Contributor

@mnajdova mnajdova commented Feb 28, 2019

This PR fix #984 by allowing arrays to be used together with the shortand props which are representing collection.

@codecov
Copy link

codecov bot commented Feb 28, 2019

Codecov Report

Merging #996 into master will increase coverage by 0.05%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #996      +/-   ##
==========================================
+ Coverage   81.34%   81.39%   +0.05%     
==========================================
  Files         673      673              
  Lines        8666     8692      +26     
  Branches     1467     1471       +4     
==========================================
+ Hits         7049     7075      +26     
  Misses       1602     1602              
  Partials       15       15
Impacted Files Coverage Δ
packages/react/src/components/Chat/ChatItem.tsx 100% <100%> (ø) ⬆️
packages/react/src/components/Button/Button.tsx 95.65% <100%> (ø) ⬆️
packages/react/src/components/Label/Label.tsx 100% <100%> (ø) ⬆️
...es/react/src/components/Reaction/ReactionGroup.tsx 100% <100%> (ø) ⬆️
packages/react/src/lib/factories.ts 95.55% <100%> (+1.7%) ⬆️
...kages/react/src/components/Indicator/Indicator.tsx 77.77% <100%> (ø) ⬆️
packages/react/src/components/List/ListItem.tsx 100% <100%> (ø) ⬆️
packages/react/src/components/Divider/Divider.tsx 100% <100%> (ø) ⬆️
.../react/src/components/Header/HeaderDescription.tsx 100% <100%> (ø) ⬆️
packages/react/src/components/Header/Header.tsx 100% <100%> (ø) ⬆️
... and 26 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7fbac5d...e495681. Read the comment docs.

@mnajdova mnajdova changed the title [WIP] chore(shorthands): allow arrays as shorthand value chore(shorthands): allow arrays as shorthand value Feb 28, 2019
@layershifter
Copy link
Member

layershifter commented Mar 1, 2019

I like the idea with object config, we can apply it to other factories (createShorthand, createShorthandFromValue), too.

@layershifter
Copy link
Member

This PR solves Issue #984

It's not enough to close the matching issue 😸
https://help.github.com/en/articles/closing-issues-using-keywords

@@ -90,6 +90,6 @@ class AccordionTitle extends UIComponent<ReactProps<AccordionTitleProps>, any> {
}
}

AccordionTitle.create = createShorthandFactory(AccordionTitle, 'content')
AccordionTitle.create = createShorthandFactory({ Component: AccordionTitle, mappedProp: 'content' })
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Component: React.ReactType
mappedProp?: string
mappedArrayProp?: string
valueOrRenderCallback?: ShorthandValue | ShorthandRenderCallback
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure about this name here... Would rather have value, as it is much simpler and shorter...

manajdov added 3 commits March 4, 2019 13:59
…shorthand-factory

# Conflicts:
#	packages/react/src/components/Dropdown/DropdownSearchInput.tsx
@@ -119,19 +149,21 @@ function createShorthandFromValue(

const valIsPrimitive = typeof value === 'string' || typeof value === 'number'
const valIsPropsObject = _.isPlainObject(value)
const valIsArrayObject = _.isArray(value)
Copy link
Member

Choose a reason for hiding this comment

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

what is ArrayObject?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will change it to valueIsArray :)

@mnajdova mnajdova merged commit 0179b3d into master Mar 4, 2019
@delete-merged-branch delete-merged-branch bot deleted the feat/allow-arrays-as-shorthands-in-create-shorthand-factory branch March 4, 2019 15:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve shorthands for component that contains collection shorthands
4 participants