This repository has been archived by the owner on Mar 4, 2020. It is now read-only.
Improve shorthands for component that contains collection shorthands #984
Labels
vsts
Paired with ticket in vsts
Feature Request
Problem description
When we are using components that contains collection of other components (like
Menu
, or some group components -ButtonGroup
), we should provide different processing of the shorthand if an array is provided. For example, let's take a look on theactionMenu
prop in theChatMessage
:This is not really user friendly API, as the
actionMenu
should probably be referred asactions
. Moreover the user has to create an object with theitems
as a key to finally define the actions they want to have on theChatMessage
.Proposed solution
Much clear API for achieving the same thing, would be the following:
With this the user should be able to define the same thing as above. Furthermore, if they want to customize the menu, they can still use the same old object for defining the
Menu
:For this to work, we may add additional parameter to the
createShorthandFactory
, that will handle arrays, the same way as we currently handle the string literals. The signature would be something like this:The text was updated successfully, but these errors were encountered: