From 0da8a7b855ece2e48fd8fb243594b4b66663a1cb Mon Sep 17 00:00:00 2001 From: Allysson Santos Date: Wed, 13 Mar 2019 20:07:06 -0300 Subject: [PATCH] fix(ListItem,ListDivider): Remove unused imports, add ListItem proptypes and fix rest operator --- components/List/ListDivider.jsx | 3 --- components/List/ListItem.jsx | 16 ++++++++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/components/List/ListDivider.jsx b/components/List/ListDivider.jsx index 701e4638..10205244 100644 --- a/components/List/ListDivider.jsx +++ b/components/List/ListDivider.jsx @@ -1,7 +1,4 @@ -import React from 'react'; -import PropTypes from 'prop-types'; import styled from 'styled-components'; -import Icon from '../Icon'; const Divider = styled.li` background-color: #a2a5a8; diff --git a/components/List/ListItem.jsx b/components/List/ListItem.jsx index 7d5f3df3..4350a44d 100644 --- a/components/List/ListItem.jsx +++ b/components/List/ListItem.jsx @@ -71,18 +71,30 @@ const Item = styled.li` `}; `; -const ListItem = ({ icon, children, onClick, rest }) => ( +const ListItem = ({ icon, children, onClick, ...rest }) => ( children.type === List, + children => children.type === List ).some(child => child)} > {icon && } {children} ); + +ListItem.PropTypes = { + icon: PropTypes.string, + children: PropTypes.node.isRequired, + onClick: PropTypes.func, +}; + +ListItem.defaultProps = { + icon: '', + onClick: () => {}, +}; + export default ListItem;