From 511b9241f5af6409bc8262579c3ecbc9decb5da4 Mon Sep 17 00:00:00 2001 From: Enrico Ros Date: Tue, 25 Feb 2025 13:09:12 -0800 Subject: [PATCH] FormLabelStart: optimize --- .../components/forms/FormLabelStart.tsx | 35 ++++++++++++------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/src/common/components/forms/FormLabelStart.tsx b/src/common/components/forms/FormLabelStart.tsx index a019574bcf..b17dcda2b4 100644 --- a/src/common/components/forms/FormLabelStart.tsx +++ b/src/common/components/forms/FormLabelStart.tsx @@ -8,28 +8,39 @@ import { GoodTooltip } from '~/common/components/GoodTooltip'; import WarningRoundedIcon from '@mui/icons-material/WarningRounded'; +const _styles = { + label: { + flexWrap: 'nowrap', + whiteSpace: 'nowrap', + } as const, + labelClickable: { + flexWrap: 'nowrap', + whiteSpace: 'nowrap', + cursor: 'pointer', + textDecoration: 'underline', + } as const, +} as const; + + /** * Shared label part (left side) */ -const FormLabelStartBase = (props: { +export const FormLabelStart = React.memo(function FormLabelStartBase(props: { title: React.ReactNode, description?: React.ReactNode, tooltip?: React.ReactNode, tooltipWarning?: boolean, onClick?: (event: React.MouseEvent) => void, sx?: SxProps, -}) => -
+}) { + return
{/* Title */} {props.title} {!!props.tooltip && ( @@ -53,6 +64,4 @@ const FormLabelStartBase = (props: { )}
; -FormLabelStartBase.displayName = 'FormLabelStart'; - -export const FormLabelStart = React.memo(FormLabelStartBase); \ No newline at end of file +});