bananas-commerce-admin
Version:
What's this, an admin for apes?
41 lines • 1.86 kB
JavaScript
import React, { useMemo } from "react";
import BentoOutlinedIcon from "@mui/icons-material/BentoOutlined";
import HomeWorkOutlinedIcon from "@mui/icons-material/HomeWorkOutlined";
import StorefrontOutlinedIcon from "@mui/icons-material/StorefrontOutlined";
import StoreOutlinedIcon from "@mui/icons-material/StoreOutlined";
import Chip from "@mui/material/Chip";
import useTheme from "@mui/material/styles/useTheme";
const OrderDestinationChip = (props) => {
const theme = useTheme();
const { element: { destination_type }, ...rest } = props;
const color = useMemo(() => {
const colorMap = {
HOME: "info",
LOCKER: "info",
SERVICE_POINT: "info",
STORE: "info",
};
return colorMap[destination_type];
}, [destination_type, theme]);
const label = useMemo(() => {
const labelMap = {
HOME: "HOME",
LOCKER: "LOCKER",
SERVICE_POINT: "SERVICE POINT",
STORE: "STORE PICKUP",
};
return labelMap[destination_type];
}, [destination_type, theme]);
const icon = useMemo(() => {
const iconMap = {
HOME: React.createElement(HomeWorkOutlinedIcon, { fontSize: "small" }),
LOCKER: React.createElement(BentoOutlinedIcon, { fontSize: "small" }),
SERVICE_POINT: React.createElement(StorefrontOutlinedIcon, { fontSize: "small" }),
STORE: React.createElement(StoreOutlinedIcon, { fontSize: "small" }),
};
return iconMap[destination_type];
}, [destination_type, theme]);
return (React.createElement(Chip, { ...rest, color: color, icon: icon, label: label, size: "small", sx: { ...rest.sx, pl: 0.5, borderWidth: 1.5 }, variant: "outlined" }));
};
export default OrderDestinationChip;
//# sourceMappingURL=OrderDestinationChip.js.map