import React, { memo, useMemo } from "react"; import { Box, Stack, Typography } from "@mui/material"; export interface LabeledValueProps { label: string; value: string | React.ReactNode; compact?: boolean; multiline?: boolean; } export const LabeledValue: React.FC = ({ label, value, compact, multiline }) => { // Use thinner font if compact and value is > 20 chars. const xsFont = useMemo( () => value != null && typeof value === "string" && value.length > 20 ? '"wdth" 75' : '"wdth" 100', [value], ); return ( {label} {typeof value === "string" ? ( {value} ) : ( {value} )} ); }; export default memo(LabeledValue);