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>
| );
| };
|
|