fix(striker-ui): remove redundant fillRow prop in outlined input with label

main
Tsu-ba-me 9 months ago
parent 8d0d685770
commit 885f4e448b
  1. 14
      striker-ui/components/OutlinedInputWithLabel.tsx
  2. 1
      striker-ui/components/StrikerConfig/AddPeerDialog.tsx

@ -20,7 +20,6 @@ import OutlinedInputLabel, {
} from './OutlinedInputLabel';
type OutlinedInputWithLabelOptionalPropsWithDefault = {
fillRow?: boolean;
formControlProps?: Partial<MUIFormControlProps>;
helpMessageBoxProps?: Partial<MessageBoxProps>;
id?: string;
@ -53,7 +52,6 @@ type OutlinedInputWithLabelProps = Pick<
const OUTLINED_INPUT_WITH_LABEL_DEFAULT_PROPS: Required<OutlinedInputWithLabelOptionalPropsWithDefault> &
OutlinedInputWithLabelOptionalPropsWithoutDefault = {
baseInputProps: undefined,
fillRow: false,
formControlProps: {},
helpMessageBoxProps: {},
id: '',
@ -70,7 +68,6 @@ const OUTLINED_INPUT_WITH_LABEL_DEFAULT_PROPS: Required<OutlinedInputWithLabelOp
const OutlinedInputWithLabel: FC<OutlinedInputWithLabelProps> = ({
baseInputProps,
disableAutofill,
fillRow: isFillRow = OUTLINED_INPUT_WITH_LABEL_DEFAULT_PROPS.fillRow,
formControlProps = OUTLINED_INPUT_WITH_LABEL_DEFAULT_PROPS.formControlProps,
helpMessageBoxProps = OUTLINED_INPUT_WITH_LABEL_DEFAULT_PROPS.helpMessageBoxProps,
id = OUTLINED_INPUT_WITH_LABEL_DEFAULT_PROPS.id,
@ -91,15 +88,10 @@ const OutlinedInputWithLabel: FC<OutlinedInputWithLabelProps> = ({
type,
value = OUTLINED_INPUT_WITH_LABEL_DEFAULT_PROPS.value,
}) => {
const { sx: formControlSx, ...restFormControlProps } = formControlProps;
const { text: helpText = '' } = helpMessageBoxProps;
const [isShowHelp, setIsShowHelp] = useState<boolean>(false);
const formControlWidth = useMemo(
() => (isFillRow ? '100%' : undefined),
[isFillRow],
);
const helpElement = useMemo(
() =>
isShowHelp && (
@ -136,11 +128,7 @@ const OutlinedInputWithLabel: FC<OutlinedInputWithLabelProps> = ({
const handleHelp = useMemo(createHelpHandler, [createHelpHandler]);
return (
<MUIFormControl
fullWidth
{...restFormControlProps}
sx={{ width: formControlWidth, ...formControlSx }}
>
<MUIFormControl fullWidth {...formControlProps}>
<OutlinedInputLabel
htmlFor={id}
isNotifyRequired={required}

@ -142,7 +142,6 @@ const AddPeerDialog = forwardRef<
<InputWithRef
input={
<OutlinedInputWithLabel
fillRow
id="add-peer-password-input"
label={LABEL.password}
type={INPUT_TYPES.password}

Loading…
Cancel
Save