@wq/material-web
Version:
Web bindings for @wq/material
47 lines (46 loc) • 1.16 kB
JavaScript
import React from "react";
import {
ListItem as MuiListItem,
ListItemText,
ListItemIcon,
ListItemSecondaryAction,
} from "@mui/material";
import PropTypes from "prop-types";
import { useIcon } from "@wq/react";
export default function ListItem({
children,
description,
icon,
secondaryAction,
...rest
}) {
const Icon = useIcon(icon);
return /*#__PURE__*/ React.createElement(
MuiListItem,
{
...rest,
},
Icon &&
/*#__PURE__*/ React.createElement(
ListItemIcon,
null,
/*#__PURE__*/ React.createElement(Icon, null)
),
/*#__PURE__*/ React.createElement(ListItemText, {
primary: children,
secondary: description,
}),
secondaryAction &&
/*#__PURE__*/ React.createElement(
ListItemSecondaryAction,
null,
secondaryAction
)
);
}
ListItem.propTypes = {
children: PropTypes.node,
description: PropTypes.node,
icon: PropTypes.string,
secondaryAction: PropTypes.node,
};