UNPKG

bananas-commerce-admin

Version:

What's this, an admin for apes?

14 lines 1.45 kB
import React from "react"; import CancelIcon from "@mui/icons-material/Cancel"; import CheckCircleIcon from "@mui/icons-material/CheckCircle"; import { CardHeader, FormControlLabel, Stack, Switch, Typography, } from "@mui/material"; import { useI18n } from "../contexts/I18nContext"; import Chip from "./Chip"; export const TableCardHeader = ({ title, avatar, isEditable = false, isDisabled = false, onChange, toggled, pills, ...props }) => { const { t } = useI18n(); return (React.createElement(CardHeader, { ...props, action: isEditable && (React.createElement(FormControlLabel, { control: React.createElement(Switch, { checked: Boolean(toggled), disabled: isDisabled && toggled, onChange: (_, v) => onChange?.(v) }), label: React.createElement(Typography, { sx: { color: "grey.600" }, variant: "body2" }, t("Edit")) })), avatar: avatar, sx: { opacity: isDisabled && toggled ? 0.5 : 1, ...props.sx }, title: React.createElement(Stack, { direction: "row", gap: 1 }, React.createElement(Typography, { sx: { fontWeight: 500, marginRight: 1 }, variant: "body1" }, title), pills?.map(({ label, color, icon }, i) => (React.createElement(Chip, { key: i, color: color ?? "success", icon: icon ?? (color === "success" ? React.createElement(CheckCircleIcon, null) : React.createElement(CancelIcon, null)), label: label, size: "small" })))) })); }; export default TableCardHeader; //# sourceMappingURL=TableCardHeader.js.map