From b2cb0a0a9920e7874b8aa2651dd2453295d29d11 Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Fri, 17 Feb 2023 22:55:30 -0500 Subject: [PATCH] fix(striker-ui): add EditFenceInputGroup --- striker-ui/components/EditFenceInputGroup.tsx | 37 +++++++++++++++++++ striker-ui/types/EditFenceInputGroup.d.ts | 12 ++++++ 2 files changed, 49 insertions(+) create mode 100644 striker-ui/components/EditFenceInputGroup.tsx create mode 100644 striker-ui/types/EditFenceInputGroup.d.ts diff --git a/striker-ui/components/EditFenceInputGroup.tsx b/striker-ui/components/EditFenceInputGroup.tsx new file mode 100644 index 00000000..2c382b54 --- /dev/null +++ b/striker-ui/components/EditFenceInputGroup.tsx @@ -0,0 +1,37 @@ +import { FC, useMemo } from 'react'; + +import CommonFenceInputGroup from './CommonFenceInputGroup'; +import Spinner from './Spinner'; + +const EditFenceInputGroup: FC = ({ + fenceId, + fenceTemplate: externalFenceTemplate, + loading: isExternalLoading, + previousFenceName, + previousFenceParameters, +}) => { + const content = useMemo( + () => + isExternalLoading ? ( + + ) : ( + + ), + [ + externalFenceTemplate, + fenceId, + isExternalLoading, + previousFenceName, + previousFenceParameters, + ], + ); + + return <>{content}; +}; + +export default EditFenceInputGroup; diff --git a/striker-ui/types/EditFenceInputGroup.d.ts b/striker-ui/types/EditFenceInputGroup.d.ts new file mode 100644 index 00000000..8d51ac2f --- /dev/null +++ b/striker-ui/types/EditFenceInputGroup.d.ts @@ -0,0 +1,12 @@ +type EditFenceInputGroupOptionalProps = { + fenceTemplate?: APIFenceTemplate; + loading?: boolean; +}; + +type EditFenceInputGroupProps = EditFenceInputGroupOptionalProps & + Required< + Pick< + CommonFenceInputGroupProps, + 'fenceId' | 'previousFenceName' | 'previousFenceParameters' + > + >;