UNPKG

@etsoo/materialui

Version:

TypeScript Material-UI Implementation

36 lines (35 loc) 1.59 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { MoreFab } from "./MoreFab"; import LinearProgress from "@mui/material/LinearProgress"; import Card from "@mui/material/Card"; import CardHeader from "@mui/material/CardHeader"; import CardContent from "@mui/material/CardContent"; import { ScrollerListExItemDefaultStyles } from "./ScrollerListEx"; /** * Default mobile list item renderer * @param param0 List renderer props * @param margin Margin * @param renderer Renderer for card content * @param cellSX Cell sx * @returns Component */ export function MobileListItemRenderer({ data }, renderer, cellSX) { // Loading if (data == null) return _jsx(LinearProgress, {}); // Elements const [title, subheader, actions, children, cardActions] = renderer(data); return (_jsxs(Card, { sx: { ...ScrollerListExItemDefaultStyles, ...cellSX }, children: [_jsx(CardHeader, { sx: { paddingBottom: 0.5 }, action: Array.isArray(actions) ? (_jsx(MoreFab, { iconButton: true, size: "small", anchorOrigin: { vertical: "bottom", horizontal: "right" }, transformOrigin: { vertical: "top", horizontal: "right" }, actions: actions })) : (actions), title: title, subheader: subheader, slotProps: { title: { variant: "body2" }, subheader: { variant: "caption" } } }), _jsx(CardContent, { children: children }), cardActions] })); }