#
luxiaotao1123
2024-11-04 7f70cb15d035f0c233b9e62b9e43aa985317c908
zy-acs-flow/src/page/agv/AgvAvatar.jsx
@@ -1,23 +1,26 @@
import * as React from 'react';
import { Avatar } from '@mui/material';
import { Avatar, Typography, useTheme } from '@mui/material';
import { useRecordContext } from 'react-admin';
import { blueGrey } from '@mui/material/colors';
export const AgvAvatar = (props) => {
    const theme = useTheme();
    const { width = 40, height = 40 } = props;
    const record = useRecordContext(props);
    if (!record) return null;
    return (
        <Avatar
            src={record.logo?.src}
            alt={record.name}
            src={record.img?.src}
            alt={record.uuid}
            sx={{
                '& img': { objectFit: 'contain' },
                width,
                height,
                fontSize: height !== 40 ? '0.6rem' : undefined,
                bgcolor: theme.palette.primary.main,
            }}
        >
            {record.name.charAt(0)}
            {record.uuid}
        </Avatar>
    );
};