#
luxiaotao1123
2024-09-20 3519a77593ecb276b0d0cfa7f5b887f8618ecdbd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import * as React from 'react';
import { Avatar } from '@mui/material';
import { useRecordContext } from 'react-admin';
 
export const AgvAvatar = (props) => {
    const { width = 40, height = 40 } = props;
    const record = useRecordContext(props);
    if (!record) return null;
    return (
        <Avatar
            src={record.logo?.src}
            alt={record.name}
            sx={{
                '& img': { objectFit: 'contain' },
                width,
                height,
                fontSize: height !== 40 ? '0.6rem' : undefined,
            }}
        >
            {record.name.charAt(0)}
        </Avatar>
    );
};