From df175e7f0df71d33237d829423c47748a2d50f0c Mon Sep 17 00:00:00 2001 From: TeoMatthew Date: Wed, 2 Aug 2017 18:08:28 +0200 Subject: [PATCH] fix #1611 (#1612) Added correct proptypes on `ListItemLayout` and updated documentation for ListItem's fields `legend` and `caption`. --- components/list/ListItemLayout.js | 10 ++++++++-- components/list/readme.md | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/components/list/ListItemLayout.js b/components/list/ListItemLayout.js index 0ee7f199..93223162 100644 --- a/components/list/ListItemLayout.js +++ b/components/list/ListItemLayout.js @@ -43,7 +43,10 @@ const factory = (Avatar, ListItemContent, ListItemActions) => { PropTypes.string, PropTypes.element, ]), - caption: PropTypes.string, + caption: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.node, + ]), className: PropTypes.string, disabled: PropTypes.bool, itemContent: PropTypes.element, @@ -52,7 +55,10 @@ const factory = (Avatar, ListItemContent, ListItemActions) => { PropTypes.string, PropTypes.element, ]), - legend: PropTypes.string, + legend: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.node, + ]), rightActions: PropTypes.arrayOf(PropTypes.node), rightIcon: PropTypes.oneOfType([ PropTypes.string, diff --git a/components/list/readme.md b/components/list/readme.md index afcc16e6..54b5a1ac 100644 --- a/components/list/readme.md +++ b/components/list/readme.md @@ -64,13 +64,13 @@ Represents a list item that can have avatar, icons, title, subtitle, etc. Note: | Name | Type | Default | Description| |:-----|:-----|:-----|:-----| | `avatar` | `String` or `Element` | | A string URL to specify an avatar in the left side of the item.| -| `caption` | `String` | | Main text of the item.| +| `caption` | `String` or `Element` | | Main text of the item.| | `className` | `String` | `''` | Set a class to give custom styles to the list item.| | `disabled` | `String` | `false` | If true, the item is displayed as disabled and is not clickable.| | `itemContent` | `Element` | | An element that will be displayed as the item. If set, this will override `caption` and `legend`.| | `leftActions` | `Array of Elements` | | A list of elements that are placed on the left side of the item and after the avatar attribute.| | `leftIcon` | `String` or `Element` | | A string key of a font icon or element to display an icon in the left side of the item. | -| `legend` | `String` | | Secondary text to display under the caption.| +| `legend` | `String` or `Element` | | Secondary text to display under the caption.| | `onClick` | `Function` | | Callback the is invoked when the item is clicked if it's not disabled. | | `rightIcon` | `String` or `Element` | | The same as the `leftIcon` but in this case the icon is displayed in the right side.| | `rightActions` | `Array of Elements` | | A list of elements that are placed on the right side of the item and after the rightIcon attribute.|