#
vincentlu
2025-05-13 ebd2f4397a92c6a5096de1b86d59154363344720
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import * as React from 'react';
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.img?.src}
            alt={record.uuid}
            sx={{
                '& img': { objectFit: 'contain' },
                width,
                height,
                fontSize: height !== 40 ? '0.6rem' : undefined,
                bgcolor: theme.palette.primary.main,
            }}
        >
            {record.uuid}
        </Avatar>
    );
};