Show image preview in detail view for x-ui-type:image fields
DetailFieldRenderer now renders a 120x120 Avatar for image-type fields instead of delegating to ListCellRenderer (which shows a tiny 40x40 avatar). Upload capability remains in the form view via ImageField.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { Box, Typography } from "@mui/material";
|
import { Box, Typography, Avatar } from "@mui/material";
|
||||||
import type { FieldConfig } from "../../types";
|
import type { FieldConfig } from "../../types";
|
||||||
import { ListCellRenderer } from "./ListCellRenderer";
|
import { ListCellRenderer } from "./ListCellRenderer";
|
||||||
|
|
||||||
@@ -18,7 +18,11 @@ export function DetailFieldRenderer({ field, value, displayFormat, basePath }: D
|
|||||||
<Typography variant="caption" color="text.secondary" fontWeight={600} sx={{ mb: 0.25, display: "block" }}>
|
<Typography variant="caption" color="text.secondary" fontWeight={600} sx={{ mb: 0.25, display: "block" }}>
|
||||||
{field.label}
|
{field.label}
|
||||||
</Typography>
|
</Typography>
|
||||||
<ListCellRenderer field={field} value={value} displayFormat={displayFormat} basePath={basePath} />
|
{field.uiType === "image" ? (
|
||||||
|
<Avatar src={value} variant="rounded" sx={{ width: 120, height: 120 }} />
|
||||||
|
) : (
|
||||||
|
<ListCellRenderer field={field} value={value} displayFormat={displayFormat} basePath={basePath} />
|
||||||
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user