mirror of
https://github.com/flarum/framework.git
synced 2025-01-19 18:12:59 +08:00
Allow non-array value to be passed into listItems
Useful in some scenarios when using JSX
This commit is contained in:
parent
c373065ab1
commit
601f7adb0f
|
@ -23,10 +23,12 @@ function withoutUnnecessarySeparators(items) {
|
|||
* The `listItems` helper wraps a collection of components in <li> tags,
|
||||
* stripping out any unnecessary `Separator` components.
|
||||
*
|
||||
* @param {Array} items
|
||||
* @param {*} items
|
||||
* @return {Array}
|
||||
*/
|
||||
export default function listItems(items) {
|
||||
if (!(items instanceof Array)) items = [items];
|
||||
|
||||
return withoutUnnecessarySeparators(items).map(item => {
|
||||
const isListItem = item.component && item.component.isListItem;
|
||||
const active = item.component && item.component.isActive && item.component.isActive(item.props);
|
||||
|
|
Loading…
Reference in New Issue
Block a user