Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | 1x 1x 1x 1x | import React, { Children, forwardRef } from 'react';
import PropTypes from 'prop-types';
import Paper from '../../../atoms/Paper';
import withStyle from '../../../Theme/withStyle';
import Body from './Body';
const ListItem = forwardRef(
({ BaseElement, center, children, css, element, href, reverse, small, ...props }, ref) => {
// eslint-disable-next-line react/prop-types
const { autoHeight, blockLevel, textLeft, ...bodyProps } = props;
return (
<BaseElement css={css} hard href={href} element={element} atomRef={ref} {...props}>
{Children.count(children) === 1 ? (
<Body center={center} reverse={reverse} small={small} {...bodyProps}>
{children}
</Body>
) : (
children
)}
</BaseElement>
);
},
);
ListItem.displayName = 'ListItem';
ListItem.propTypes = {
BaseElement: PropTypes.oneOfType([
PropTypes.elementType,
PropTypes.shape({ render: PropTypes.func.isRequired }),
]),
center: PropTypes.bool,
children: PropTypes.node.isRequired,
css: PropTypes.shape().isRequired,
href: PropTypes.string,
element: PropTypes.string,
reverse: PropTypes.bool,
small: PropTypes.bool,
};
ListItem.defaultProps = {
BaseElement: Paper,
center: false,
element: undefined,
href: null,
reverse: false,
small: false,
};
export default withStyle(ListItem);
|