b70ee7c55d
Change-Id: Ia03486edfd934438580e614af754a0966f6fd6e3
13 lines
354 B
JavaScript
13 lines
354 B
JavaScript
import React from "react";
|
|
import get from "lodash/get";
|
|
import { Avatar } from "@mui/material";
|
|
import { useRecordContext } from "react-admin";
|
|
|
|
const AvatarField = ({ source, ...rest }) => {
|
|
const record = useRecordContext(rest);
|
|
const src = get(record, source)?.toString();
|
|
return <Avatar src={src} {...rest} />;
|
|
};
|
|
|
|
export default AvatarField;
|